step 16 : percantik dropdown jenis
This commit is contained in:
121
v1/js/settings.js
Normal file
121
v1/js/settings.js
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
document.addEventListener('alpine:init', () => {
|
||||||
|
Alpine.data('settingsPage', () => ({
|
||||||
|
// 1. Inisialisasi Start
|
||||||
|
showDialogAdd: false,
|
||||||
|
objAddForm: {
|
||||||
|
// idJenis 1
|
||||||
|
port: '',
|
||||||
|
idInterface: -1,
|
||||||
|
namaInterface: '',
|
||||||
|
idInstrument: -1,
|
||||||
|
namaInstrument: '',
|
||||||
|
},
|
||||||
|
dataSetting: [
|
||||||
|
{
|
||||||
|
idSetting: 1,
|
||||||
|
idJenis: 1,
|
||||||
|
namaJenis: 'TCP Server',
|
||||||
|
info: 'Port 5001',
|
||||||
|
port: '5001',
|
||||||
|
idInterface: 1,
|
||||||
|
namaInterface: 'XN550',
|
||||||
|
idInstrument: 1,
|
||||||
|
namaInstrument: 'Hema 01',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
idSetting: 2,
|
||||||
|
idJenis: 2,
|
||||||
|
namaJenis: 'TCP Client',
|
||||||
|
info: 'Server 192.168.0.1, Port 4000',
|
||||||
|
port: 'Server 192.168.0.1, Port 4000',
|
||||||
|
idInterface: 2,
|
||||||
|
namaInterface: 'Axsym',
|
||||||
|
idInstrument: 2,
|
||||||
|
namaInstrument: 'Axsym',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
idSetting: 3,
|
||||||
|
idJenis: 3,
|
||||||
|
namaJenis: 'RS232',
|
||||||
|
info: 'ttyS01, 9600, N, 8, 1',
|
||||||
|
port: 'ttyS01, 9600, N, 8, 1',
|
||||||
|
idInterface: 3,
|
||||||
|
namaInterface: 'C311',
|
||||||
|
idInstrument: 3,
|
||||||
|
namaInstrument: 'Cobas C311',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
selectedJenis: {
|
||||||
|
idJenis: -1,
|
||||||
|
namaJenis: 'Jenis'
|
||||||
|
},
|
||||||
|
openJenis: false,
|
||||||
|
dataJenis: [
|
||||||
|
{
|
||||||
|
idJenis: 1,
|
||||||
|
namaJenis: 'TCP Server',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
idJenis: 2,
|
||||||
|
namaJenis: 'TCP Client',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
idJenis: 3,
|
||||||
|
namaJenis: 'RS232',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
selectedInterface: {
|
||||||
|
idInterface: -1,
|
||||||
|
namaInterface: 'Interface'
|
||||||
|
},
|
||||||
|
openInterface: false,
|
||||||
|
dataInterface: [
|
||||||
|
{
|
||||||
|
idInterface: 1,
|
||||||
|
namaInterface: 'XN550',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
idInterface: 2,
|
||||||
|
namaInterface: 'Axsym',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
idInterface: 3,
|
||||||
|
namaInterface: 'C311',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
selectedInstrument: {
|
||||||
|
idInstrument: -1,
|
||||||
|
namaInstrument: 'Instrument'
|
||||||
|
},
|
||||||
|
openInstrument: false,
|
||||||
|
dataInstrument: [
|
||||||
|
{
|
||||||
|
idInstrument: 1,
|
||||||
|
namaInstrument: 'Hema 01',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
idInstrument: 2,
|
||||||
|
namaInstrument: 'Axsym',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
idInstrument: 3,
|
||||||
|
namaInstrument: 'Cobas C311',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
// 1. Inisialisasi End
|
||||||
|
// 2. Fungsi Start
|
||||||
|
onChangeJenis(item) {
|
||||||
|
this.openJenis = false;
|
||||||
|
this.selectedJenis = item;
|
||||||
|
// clear form
|
||||||
|
this.objAddForm = {
|
||||||
|
port: '',
|
||||||
|
idInterface: -1,
|
||||||
|
namaInterface: '',
|
||||||
|
idInstrument: -1,
|
||||||
|
namaInstrument: '',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
// 2. Fungsi End
|
||||||
|
}))
|
||||||
|
})
|
||||||
167
v1/settings.html
167
v1/settings.html
@@ -114,101 +114,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Konten utama -->
|
<!-- Konten utama -->
|
||||||
<div class="flex-1 flex flex-col lg:flex-row p-6 gap-5 overflow-hidden h-screen" x-data="{
|
<div class="flex-1 flex flex-col lg:flex-row p-6 gap-5 overflow-hidden h-screen" x-data="settingsPage">
|
||||||
showDialogAdd: false,
|
|
||||||
dataSetting: [
|
|
||||||
{
|
|
||||||
idSetting: 1,
|
|
||||||
idJenis: 1,
|
|
||||||
namaJenis: 'TCP Server',
|
|
||||||
info: 'Port 5001',
|
|
||||||
port: '5001',
|
|
||||||
idInterface: 1,
|
|
||||||
namaInterface: 'XN550',
|
|
||||||
idInstrument: 1,
|
|
||||||
namaInstrument: 'Hema 01',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idSetting: 2,
|
|
||||||
idJenis: 2,
|
|
||||||
namaJenis: 'TCP Client',
|
|
||||||
info: 'Server 192.168.0.1, Port 4000',
|
|
||||||
port: 'Server 192.168.0.1, Port 4000',
|
|
||||||
idInterface: 2,
|
|
||||||
namaInterface: 'Axsym',
|
|
||||||
idInstrument: 2,
|
|
||||||
namaInstrument: 'Axsym',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idSetting: 3,
|
|
||||||
idJenis: 3,
|
|
||||||
namaJenis:'RS232',
|
|
||||||
info: 'ttyS01, 9600, N, 8, 1',
|
|
||||||
port: 'ttyS01, 9600, N, 8, 1',
|
|
||||||
idInterface: 3,
|
|
||||||
namaInterface: 'C311',
|
|
||||||
idInstrument: 3,
|
|
||||||
namaInstrument: 'Cobas C311',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
selectedJenis: {
|
|
||||||
idJenis: -1,
|
|
||||||
namaJenis: 'Jenis'
|
|
||||||
},
|
|
||||||
openJenis: false,
|
|
||||||
dataJenis: [
|
|
||||||
{
|
|
||||||
idJenis:1,
|
|
||||||
namaJenis:'TCP Server',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idJenis:2,
|
|
||||||
namaJenis:'TCP Client',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idJenis:3,
|
|
||||||
namaJenis:'RS232',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
selectedInterface: {
|
|
||||||
idInterface: -1,
|
|
||||||
namaInterface: 'Interface'
|
|
||||||
},
|
|
||||||
openInterface: false,
|
|
||||||
dataInterface: [
|
|
||||||
{
|
|
||||||
idInterface: 1,
|
|
||||||
namaInterface: 'XN550',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idInterface: 2,
|
|
||||||
namaInterface: 'Axsym',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idInterface: 3,
|
|
||||||
namaInterface: 'C311',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
selectedInstrument: {
|
|
||||||
idInstrument: -1,
|
|
||||||
namaInstrument: 'Instrument'
|
|
||||||
},
|
|
||||||
openInstrument: false,
|
|
||||||
dataInstrument: [
|
|
||||||
{
|
|
||||||
idInstrument: 1,
|
|
||||||
namaInstrument: 'Hema 01',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idInstrument: 2,
|
|
||||||
namaInstrument: 'Axsym',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idInstrument: 3,
|
|
||||||
namaInstrument: 'Cobas C311',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}">
|
|
||||||
<!-- Bagian Kiri (Tabel) -->
|
<!-- Bagian Kiri (Tabel) -->
|
||||||
<div class="hidden lg: bg-white w-full lg:w-1/2 rounded-lg p-5 lg:flex flex-col flex-1 overflow-hidden">
|
<div class="hidden lg: bg-white w-full lg:w-1/2 rounded-lg p-5 lg:flex flex-col flex-1 overflow-hidden">
|
||||||
<div class="p-2 text-black font-medium text-lg rounded-lg">Setting</div>
|
<div class="p-2 text-black font-medium text-lg rounded-lg">Setting</div>
|
||||||
@@ -232,10 +138,14 @@
|
|||||||
<tbody class="divide-y divide-gray-200">
|
<tbody class="divide-y divide-gray-200">
|
||||||
<template x-for="item in dataSetting" :key="item.idSetting">
|
<template x-for="item in dataSetting" :key="item.idSetting">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-wrap align-top text-left font-normal text-xs text-black/87 p-2" x-text="item.namaJenis"></td>
|
<td class="text-wrap align-top text-left font-normal text-xs text-black/87 p-2"
|
||||||
<td class="text-wrap align-top text-left font-normal text-xs text-black/87 p-2" x-text="item.info"></td>
|
x-text="item.namaJenis"></td>
|
||||||
<td class="text-wrap align-top text-left font-normal text-xs text-black/87 p-2" x-text="item.namaInstrument"></td>
|
<td class="text-wrap align-top text-left font-normal text-xs text-black/87 p-2"
|
||||||
<td class="text-wrap align-top text-left font-normal text-xs text-black/87 p-2" x-text="item.namaInterface"></td>
|
x-text="item.info"></td>
|
||||||
|
<td class="text-wrap align-top text-left font-normal text-xs text-black/87 p-2"
|
||||||
|
x-text="item.namaInstrument"></td>
|
||||||
|
<td class="text-wrap align-top text-left font-normal text-xs text-black/87 p-2"
|
||||||
|
x-text="item.namaInterface"></td>
|
||||||
<td class="text-wrap align-top text-center font-normal text-xs text-[#2196F3] p-2">
|
<td class="text-wrap align-top text-center font-normal text-xs text-[#2196F3] p-2">
|
||||||
<button><span class="material-symbols-outlined">edit</span></button>
|
<button><span class="material-symbols-outlined">edit</span></button>
|
||||||
</td>
|
</td>
|
||||||
@@ -259,27 +169,64 @@
|
|||||||
<!-- body -->
|
<!-- body -->
|
||||||
<div class="flex flex-1 bg-white px-6 py-5">
|
<div class="flex flex-1 bg-white px-6 py-5">
|
||||||
<div class="relative w-full">
|
<div class="relative w-full">
|
||||||
|
<p x-text="selectedJenis.idJenis"></p><br/>
|
||||||
<!-- buka dropdown -->
|
<!-- buka dropdown -->
|
||||||
<button
|
<fieldset
|
||||||
@click="openJenis = !openJenis"
|
@click.outside="openJenis = false"
|
||||||
x-text="selectedJenis.idJenis != -1 ? selectedJenis.namaJenis : 'Jenis'"
|
class="relative border border-gray-400 rounded-md focus-within:border-blue-500 focus-within:ring-1 focus-within:ring-blue-500 px-3 pt-2 pb-2">
|
||||||
class="w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 text-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-left">
|
<span
|
||||||
</button>
|
x-text="selectedJenis.idJenis != -1 ? 'Jenis' : selectedJenis.namaJenis"
|
||||||
|
class="pointer-events-none absolute start-2.5 top-0 -translate-y-1/2 bg-white p-0.5 text-xs text-gray-700 transition-all peer-placeholder-shown:top-1/2 peer-placeholder-shown:text-sm peer-focus:top-0 peer-focus:text-xs">
|
||||||
|
</span>
|
||||||
|
<button @click="openJenis = !openJenis" type="button"
|
||||||
|
class="w-full flex items-center justify-between bg-transparent text-gray-900 py-0.5 focus:outline-none">
|
||||||
|
<span x-text="selectedJenis.namaJenis" class="text-left"></span>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 transition-transform"
|
||||||
|
:class="{ 'rotate-180': openJenis }" fill="none" viewBox="0 0 24 24"
|
||||||
|
stroke="currentColor">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||||
|
d="M19 9l-7 7-7-7" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<!-- list menu -->
|
<!-- list menu -->
|
||||||
<div
|
<div x-show="openJenis"
|
||||||
x-show="openJenis"
|
|
||||||
class="absolute bg-white w-full border border-gray-300 rounded-md shadow-lg z-10 max-h-[200px] overflow-y-auto">
|
class="absolute bg-white w-full border border-gray-300 rounded-md shadow-lg z-10 max-h-[200px] overflow-y-auto">
|
||||||
<ul>
|
<ul>
|
||||||
<template x-for="item in dataJenis" :key="item.idJenis">
|
<template x-for="item in dataJenis" :key="item.idJenis">
|
||||||
<li
|
<li :id="item.idJenis" @click="onChangeJenis(item)"
|
||||||
:id="item.idJenis"
|
|
||||||
@click="selectedJenis = item; openJenis = false"
|
|
||||||
class="py-2 px-3 hover:bg-blue-100 cursor-pointer text-gray-700">
|
class="py-2 px-3 hover:bg-blue-100 cursor-pointer text-gray-700">
|
||||||
<button x-text="item.namaJenis"></button>
|
<button x-text="item.namaJenis"></button>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- namaJenis TCP Server -->
|
||||||
|
<template x-if="selectedJenis.idJenis === 1">
|
||||||
|
<div class="mt-5">
|
||||||
|
<label for="Port"
|
||||||
|
class="relative block rounded-md border border-gray-400 focus-within:border-blue-600 focus-within:ring-1 focus-within:ring-blue-600">
|
||||||
|
<input type="text" id="Port"
|
||||||
|
class="peer pl-2 border-none py-3 bg-transparent placeholder-transparent focus:border-transparent focus:ring-0 focus:outline-hidden"
|
||||||
|
placeholder="Port" />
|
||||||
|
|
||||||
|
<span
|
||||||
|
class="pointer-events-none absolute start-2.5 top-0 -translate-y-1/2 bg-white p-0.5 text-xs text-gray-700 transition-all peer-placeholder-shown:top-1/2 peer-placeholder-shown:text-sm peer-focus:top-0 peer-focus:text-xs">
|
||||||
|
Port
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<!-- namaJenis TCP Server -->
|
||||||
|
|
||||||
|
<!-- namaJenis TCP Client -->
|
||||||
|
<template x-if="selectedJenis.idJenis === 2">
|
||||||
|
<p>Nama Jenis TCP Client</p>
|
||||||
|
<br />
|
||||||
|
</template>
|
||||||
|
<!-- namaJenis TCP Client -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
@@ -374,6 +321,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script src="js/settings.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user