Commit 9fd4c18f authored by Sarun Mungthanya's avatar Sarun Mungthanya
Browse files

issue serverlicense creaet

parent 5fc7bb44
...@@ -10,16 +10,17 @@ use Livewire\Component; ...@@ -10,16 +10,17 @@ use Livewire\Component;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use App\Models\ConfServerLicense; use App\Models\ConfServerLicense;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
class ServerLicenseCreate extends Component class ServerLicenseCreate extends Component
{ {
public $phpVersions = []; public $phpVersions = [];
public $teams ; public $teams;
public $sizings = []; public $sizings = [];
public $customerTypes = []; public $customerTypes = [];
public $dbTypes = []; public $dbTypes = [];
public $ownerTypes = []; public $ownerTypes = [];
public $serverKey; public $serverKey;
public $teamId; public $teamId;
public $customerSize; public $customerSize;
...@@ -37,8 +38,6 @@ class ServerLicenseCreate extends Component ...@@ -37,8 +38,6 @@ class ServerLicenseCreate extends Component
public $hscodeMethod = 1; public $hscodeMethod = 1;
public $customerUrl; public $customerUrl;
public $contact; public $contact;
public $contactCustomerName;
protected $rules = [ protected $rules = [
'serverKey' => 'required|string|max:255', 'serverKey' => 'required|string|max:255',
...@@ -62,10 +61,32 @@ class ServerLicenseCreate extends Component ...@@ -62,10 +61,32 @@ class ServerLicenseCreate extends Component
]; ];
public function mount() public function mount()
{ {
$this->phpVersionId = DB::table('master_php_ver')
->orderBy('id', 'asc')
->first()->id;
$this->teamId = DB::table('master_team')
->orderBy('id', 'asc')
->first()->id;
$this->customerSize = DB::table('master_size')
->orderBy('id', 'asc')
->first()->id;
$this->customerType = DB::table('master_sizeType')
->orderBy('id', 'asc')
->first()->id;
$this->databaseType = DB::table('master_dbtype')
->orderBy('id', 'asc')
->first()->id;
$this->ownerType = DB::table('conf_server_ownertype')
->orderBy('owntypeid', 'asc')
->first()->id;
} }
public function save() public function save()
{ {
$this->validate(); $this->validate();
...@@ -90,10 +111,10 @@ class ServerLicenseCreate extends Component ...@@ -90,10 +111,10 @@ class ServerLicenseCreate extends Component
'CONTACT' => $this->contact, 'CONTACT' => $this->contact,
'CONTACTCUSTOMERNAME' => $this->contactCustomerName, 'CONTACTCUSTOMERNAME' => $this->contactCustomerName,
]); ]);
return redirect()->route('server-license.index')->with('message', 'Server License saved successfully.'); return redirect()->route('server-license.index')->with('message', 'Server License saved successfully.');
} }
public function loadPage($page) public function loadPage($page)
{ {
...@@ -102,28 +123,29 @@ class ServerLicenseCreate extends Component ...@@ -102,28 +123,29 @@ class ServerLicenseCreate extends Component
public function render() public function render()
{ {
$this->phpVersions = DB::table('master_php_ver') $this->phpVersions = DB::table('master_php_ver')
->orderBy('id', 'asc') ->orderBy('id', 'asc')
->get(); ->get();
$this->teams = DB::table('master_team')
->orderBy('id', 'asc')
->get();
$this->teams = DB::table('master_team') $this->sizings = DB::table('master_size')
->orderBy('id', 'asc') ->orderBy('id', 'asc')
->get(); ->get();
$this->sizings = DB::table('master_size') $this->customerTypes = DB::table('master_sizeType')
->orderBy('id', 'asc') ->orderBy('id', 'asc')
->get(); ->get();
$this->customerTypes = DB::table('master_sizeType') $this->dbTypes = DB::table('master_dbtype')
->orderBy('id', 'asc') ->orderBy('id', 'asc')
->get(); ->get();
$this->dbTypes = DB::table('master_dbtype') $this->ownerTypes = DB::table('conf_server_ownertype')
->orderBy('id', 'asc') ->orderBy('owntypeid', 'asc')
->get(); ->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');
} }
} }
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
<div class="flex flex-col w-3/4"> <div class="flex flex-col w-3/4">
<select id="teamId" wire:model.defer="teamId" <select id="teamId" wire:model.defer="teamId"
class=" p-2 border border-gray-300 rounded-md"> class=" p-2 border border-gray-300 rounded-md">
<option value="">Please Select</option>
@foreach ($teams as $team) @foreach ($teams as $team)
<option value="{{ $team->id }}">{{ $team->teamName }}</option> <option value="{{ $team->id }}">{{ $team->teamName }}</option>
@endforeach @endforeach
...@@ -48,7 +47,6 @@ ...@@ -48,7 +47,6 @@
<div class="flex flex-col w-3/4"> <div class="flex flex-col w-3/4">
<select id="customerSize" wire:model.defer="customerSize" <select id="customerSize" wire:model.defer="customerSize"
class=" p-2 border border-gray-300 rounded-md"> class=" p-2 border border-gray-300 rounded-md">
<option value="">Please Select</option>
@foreach ($sizings as $size) @foreach ($sizings as $size)
<option value="{{ $size->id }}">{{ $size->sizeName }}</option> <option value="{{ $size->id }}">{{ $size->sizeName }}</option>
@endforeach @endforeach
...@@ -66,7 +64,6 @@ ...@@ -66,7 +64,6 @@
<div class="flex flex-col w-3/4"> <div class="flex flex-col w-3/4">
<select id="customerType" wire:model.defer="customerType" <select id="customerType" wire:model.defer="customerType"
class=" p-2 border border-gray-300 rounded-md"> class=" p-2 border border-gray-300 rounded-md">
<option value="">Please Select</option>
@foreach ($customerTypes as $type) @foreach ($customerTypes as $type)
<option value="{{ $type->id }}">{{ $type->sizeTypeName }}</option> <option value="{{ $type->id }}">{{ $type->sizeTypeName }}</option>
@endforeach @endforeach
...@@ -142,7 +139,6 @@ ...@@ -142,7 +139,6 @@
<div class="flex flex-col w-3/4"> <div class="flex flex-col w-3/4">
<select id="phpVersionId" wire:model.defer="phpVersionId" <select id="phpVersionId" wire:model.defer="phpVersionId"
class=" p-2 border border-gray-300 rounded-md"> class=" p-2 border border-gray-300 rounded-md">
<option value="">Please Select</option>
@foreach ($phpVersions as $version) @foreach ($phpVersions as $version)
<option value="{{ $version->id }}">{{ $version->version }}</option> <option value="{{ $version->id }}">{{ $version->version }}</option>
@endforeach @endforeach
...@@ -199,7 +195,6 @@ ...@@ -199,7 +195,6 @@
<div class="flex flex-col w-3/4"> <div class="flex flex-col w-3/4">
<select id="databaseType" wire:model.defer="databaseType" <select id="databaseType" wire:model.defer="databaseType"
class=" p-2 border border-gray-300 rounded-md"> class=" p-2 border border-gray-300 rounded-md">
<option value="">Please Select</option>
@foreach ($dbTypes as $db) @foreach ($dbTypes as $db)
<option value="{{ $db->id }}">{{ $db->dbName }}</option> <option value="{{ $db->id }}">{{ $db->dbName }}</option>
@endforeach @endforeach
...@@ -217,7 +212,6 @@ ...@@ -217,7 +212,6 @@
<div class="flex flex-col w-3/4"> <div class="flex flex-col w-3/4">
<select id="ownerType" wire:model.defer="ownerType" <select id="ownerType" wire:model.defer="ownerType"
class=" p-2 border border-gray-300 rounded-md"> class=" p-2 border border-gray-300 rounded-md">
<option value="">Please Select</option>
@foreach ($ownerTypes as $owner) @foreach ($ownerTypes as $owner)
<option value="{{ $owner->owntype_code }}">{{ $owner->owntype_description }} <option value="{{ $owner->owntype_code }}">{{ $owner->owntype_description }}
</option> </option>
...@@ -236,7 +230,6 @@ ...@@ -236,7 +230,6 @@
<div class="flex flex-col w-3/4"> <div class="flex flex-col w-3/4">
<select id="hscodeMethod" wire:model.defer="hscodeMethod" <select id="hscodeMethod" wire:model.defer="hscodeMethod"
class=" p-2 border border-gray-300 rounded-md"> class=" p-2 border border-gray-300 rounded-md">
<option value="">Please Select</option>
<option value="1" {{ $hscodeMethod == '1' ? 'selected' : '' }}>Patch</option> <option value="1" {{ $hscodeMethod == '1' ? 'selected' : '' }}>Patch</option>
<option value="2" {{ $hscodeMethod == '2' ? 'selected' : '' }}>Run script <option value="2" {{ $hscodeMethod == '2' ? 'selected' : '' }}>Run script
</option> </option>
......
<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 ">
<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">
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
class="inline-block py-2 px-4">File Download</a> class="inline-block py-2 px-4">File Download</a>
</li> </li>
<li class="mr-2"> <li class="mr-2">
<a href="#" @click.prevent="activeTab = 'historyPatch'" wire:click="loadHistoryPatch" <a href="#" @click.prevent="activeTab = 'historyPatch'" wire:click="loadHistoryPatch"
:class="{ 'border-b-2 border-blue-600 text-blue-600': activeTab === 'historyPatch' }" :class="{ 'border-b-2 border-blue-600 text-blue-600': activeTab === 'historyPatch' }"
class="inline-block py-2 px-4">History Patch</a> class="inline-block py-2 px-4">History Patch</a>
</li> </li>
...@@ -91,8 +91,8 @@ ...@@ -91,8 +91,8 @@
<!-- Server Key --> <!-- Server Key -->
<div class="mb-4 flex items-center"> <div class="mb-4 flex items-center">
<label for="serverKey" class="w-1/4 text-gray-700">Server Key</label> <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" <input type="text" id="serverKey"
wire:model.defer="serverKey"> class="w-3/4 p-2 border border-gray-300 rounded-md" wire:model.defer="serverKey">
</div> </div>
<!-- Team --> <!-- Team -->
...@@ -100,7 +100,6 @@ ...@@ -100,7 +100,6 @@
<label for="teamId" class="w-1/4 text-gray-700">Team</label> <label for="teamId" class="w-1/4 text-gray-700">Team</label>
<select id="teamId" wire:model.defer="teamId" <select id="teamId" wire:model.defer="teamId"
class="w-3/4 p-2 border border-gray-300 rounded-md"> class="w-3/4 p-2 border border-gray-300 rounded-md">
<option value="">Please Select</option>
@foreach ($teams as $team) @foreach ($teams as $team)
<option value="{{ is_object($team) ? $team->id : $team['id'] }}"> <option value="{{ is_object($team) ? $team->id : $team['id'] }}">
{{ is_object($team) ? $team->teamName : $team['teamName'] }}</option> {{ is_object($team) ? $team->teamName : $team['teamName'] }}</option>
...@@ -113,7 +112,6 @@ ...@@ -113,7 +112,6 @@
<label for="customerSize" class="w-1/4 text-gray-700">Customer Sizing</label> <label for="customerSize" class="w-1/4 text-gray-700">Customer Sizing</label>
<select id="customerSize" wire:model.defer="customerSize" <select id="customerSize" wire:model.defer="customerSize"
class="w-3/4 p-2 border border-gray-300 rounded-md"> class="w-3/4 p-2 border border-gray-300 rounded-md">
<option value="">Please Select</option>
@foreach ($sizings as $size) @foreach ($sizings as $size)
<option value="{{ is_object($size) ? $size->id : $size['id'] }}"> <option value="{{ is_object($size) ? $size->id : $size['id'] }}">
{{ is_object($size) ? $size->sizeName : $size['sizeName'] }}</option> {{ is_object($size) ? $size->sizeName : $size['sizeName'] }}</option>
...@@ -126,7 +124,6 @@ ...@@ -126,7 +124,6 @@
<label for="customerType" class="w-1/4 text-gray-700">Customer Type</label> <label for="customerType" class="w-1/4 text-gray-700">Customer Type</label>
<select id="customerType" wire:model.defer="customerType" <select id="customerType" wire:model.defer="customerType"
class="w-3/4 p-2 border border-gray-300 rounded-md"> class="w-3/4 p-2 border border-gray-300 rounded-md">
<option value="">Please Select</option>
@foreach ($customerTypes as $type) @foreach ($customerTypes as $type)
<option value="{{ is_object($type) ? $type->id : $type['id'] }}"> <option value="{{ is_object($type) ? $type->id : $type['id'] }}">
{{ is_object($type) ? $type->sizeTypeName : $type['sizeTypeName'] }} {{ is_object($type) ? $type->sizeTypeName : $type['sizeTypeName'] }}
...@@ -177,7 +174,6 @@ ...@@ -177,7 +174,6 @@
<label for="phpVersionId" class="w-1/4 text-gray-700">PHP Version</label> <label for="phpVersionId" class="w-1/4 text-gray-700">PHP Version</label>
<select id="phpVersionId" wire:model.defer="phpVersionId" <select id="phpVersionId" wire:model.defer="phpVersionId"
class="w-3/4 p-2 border border-gray-300 rounded-md"> class="w-3/4 p-2 border border-gray-300 rounded-md">
<option value="">Please Select</option>
@foreach ($phpVersions as $version) @foreach ($phpVersions as $version)
<option value="{{ is_object($version) ? $version->id : $version['id'] }}"> <option value="{{ is_object($version) ? $version->id : $version['id'] }}">
{{ is_object($version) ? $version->version : $version['version'] }}</option> {{ is_object($version) ? $version->version : $version['version'] }}</option>
...@@ -211,7 +207,6 @@ ...@@ -211,7 +207,6 @@
<label for="databaseType" class="w-1/4 text-gray-700">Database Type</label> <label for="databaseType" class="w-1/4 text-gray-700">Database Type</label>
<select id="databaseType" wire:model.defer="databaseType" <select id="databaseType" wire:model.defer="databaseType"
class="w-3/4 p-2 border border-gray-300 rounded-md"> class="w-3/4 p-2 border border-gray-300 rounded-md">
<option value="">Please Select</option>
@foreach ($dbTypes as $db) @foreach ($dbTypes as $db)
<option value="{{ is_object($db) ? $db->id : $db['id'] }}"> <option value="{{ is_object($db) ? $db->id : $db['id'] }}">
{{ is_object($db) ? $db->dbName : $db['dbName'] }}</option> {{ is_object($db) ? $db->dbName : $db['dbName'] }}</option>
...@@ -224,7 +219,6 @@ ...@@ -224,7 +219,6 @@
<label for="ownerType" class="w-1/4 text-gray-700">Server of</label> <label for="ownerType" class="w-1/4 text-gray-700">Server of</label>
<select id="ownerType" wire:model.defer="ownerType" <select id="ownerType" wire:model.defer="ownerType"
class="w-3/4 p-2 border border-gray-300 rounded-md"> class="w-3/4 p-2 border border-gray-300 rounded-md">
<option value="">Please Select</option>
@foreach ($ownerTypes as $owner) @foreach ($ownerTypes as $owner)
<option <option
value="{{ is_object($owner) ? $owner->owntype_code : $owner['owntype_code'] }}"> value="{{ is_object($owner) ? $owner->owntype_code : $owner['owntype_code'] }}">
...@@ -238,7 +232,6 @@ ...@@ -238,7 +232,6 @@
<label for="hscodeMethod" class="w-1/4 text-gray-700">HSCODE 2017 Method</label> <label for="hscodeMethod" class="w-1/4 text-gray-700">HSCODE 2017 Method</label>
<select id="hscodeMethod" wire:model.defer="hscodeMethod" <select id="hscodeMethod" wire:model.defer="hscodeMethod"
class="w-3/4 p-2 border border-gray-300 rounded-md"> class="w-3/4 p-2 border border-gray-300 rounded-md">
<option value="">Please Select</option>
<option value="1" {{ $hscodeMethod == '1' ? 'selected' : '' }}>Patch</option> <option value="1" {{ $hscodeMethod == '1' ? 'selected' : '' }}>Patch</option>
<option value="2" {{ $hscodeMethod == '2' ? 'selected' : '' }}>Run script <option value="2" {{ $hscodeMethod == '2' ? 'selected' : '' }}>Run script
</option> </option>
...@@ -264,7 +257,7 @@ ...@@ -264,7 +257,7 @@
</div> </div>
<div class="flex justify-center space-x-2"> <div class="flex justify-center space-x-2">
<a type="button" href="/server-license" <a type="button" href="/server-license"
class="bg-slate-700 text-white px-4 py-2 rounded-md hover:bg-slate-900">Back</a> 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>
...@@ -328,9 +321,7 @@ ...@@ -328,9 +321,7 @@
</div> </div>
<div x-show="activeTab === 'historyPatch'"> <div x-show="activeTab === 'historyPatch'">
@if ($tab === 'historyPatch') @if ($tab === 'historyPatch')
@include('livewire.pages.server-license.history-patch', [ @include('livewire.pages.server-license.history-patch', ['historyPatchList' => $historyPatchList])
'historyPatchList' => $historyPatchList,
])
@endif @endif
</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