This commit is contained in:
fifi97
2021-12-01 10:33:11 +08:00
parent 11ea68cdc1
commit 587d2a2204
3 changed files with 195 additions and 10473 deletions
+36 -10428
View File
File diff suppressed because it is too large Load Diff
+76 -18
View File
@@ -16986,32 +16986,82 @@ __webpack_require__.r(__webpack_exports__);
//
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
props: {
placement: {
type: String,
"default": "bottom-start"
}
},
data: function data() {
return {
dropdownShow: false,
arrayCustomer: []
arrayCustomer: Object
};
},
computed: {
getData: function getData() {
var _this = this;
var data = this.axios.get('http://localhost:8000/api/customers/630411035213').then(function (response) {
// this.arrayCustomer.push(response.data)
_this.arrayCustomer = response.data;
});
return data;
}
mounted: function mounted() {
document.addEventListener('click', this.onClick);
},
beforeDestroy: function beforeDestroy() {
document.removeEventListener('click', this.onClick);
},
methods: {
toggleDropdown: function toggleDropdown() {
if (this.dropdownShow) {
this.dropdownShow = false;
} else {
this.getData();
if (this.arrayCustomer.length > 0) {
// if(this.dropdownShow){
// this.dropdownShow = false;
// } else {
this.dropdownShow = true;
(0,_popperjs_core__WEBPACK_IMPORTED_MODULE_0__.createPopper)(this.$refs.btnDropdownRef, this.$refs.popoverDropdownRef, {
placement: "bottom-start"
placement: "bottom-start",
modifiers: [{
name: "preventOverflow"
}]
}); // }
}
},
getData: function getData() {
var _this = this;
var inputvalue = document.getElementById("frminput").value;
if (inputvalue) if (this.hasNumber(inputvalue)) {
this.axios.get('http://localhost:8000/admin/searchByIC', {
params: {
ic: inputvalue
}
}).then(function (response) {
_this.arrayCustomer = response.data;
})["catch"](function (error) {
console.log(error);
});
} else {
this.axios.get('http://localhost:8000/admin/searchByName', {
params: {
nama: inputvalue
}
}).then(function (response) {
_this.arrayCustomer = response.data;
})["catch"](function (error) {
console.log(error);
});
}
},
hasNumber: function hasNumber(inputString) {
return /\d/.test(inputString);
},
onClick: function onClick() {
var isClickInside = this.$refs.popoverDropdownRef.contains(event.target);
var searchInside = this.$refs.btnDropdownRef.contains(event.target);
var buttonSearch = document.getElementById('buttonsearch');
if (isClickInside || searchInside || buttonSearch.contains(event.target)) {
if (buttonSearch.value !== '') {
this.dropdownShow = true;
}
} else {
this.dropdownShow = false;
this.arrayCustomer = [];
}
}
}
@@ -55117,6 +55167,7 @@ var render = function () {
{
staticClass:
"bg-white w-full shadow-md rounded-lg px-8 pt-6 pb-4 mb-4",
attrs: { onclick: "return false" },
},
[
_c("div", { staticClass: "mb-4 w-96 mx-auto" }, [
@@ -55134,6 +55185,7 @@ var render = function () {
staticClass:
"mr-2 bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-blue-500",
attrs: {
id: "frminput",
type: "text",
placeholder: "Masukkan IC atau Nama",
},
@@ -55168,7 +55220,6 @@ var render = function () {
staticClass:
"text-gray-700 block px-4 py-2 text-sm hover:bg-yellow-500",
attrs: {
href: "#",
role: "menuitem",
tabindex: "-1",
id: "menu-item-0",
@@ -55177,7 +55228,13 @@ var render = function () {
[
_vm._v(_vm._s(cust.nama)),
_c("br"),
_c("b", [_vm._v(_vm._s(cust.kpbaru))]),
_c("b", [
_vm._v(
_vm._s(
cust.kpbaru ? cust.kpbaru : cust.kplama
)
),
]),
]
)
}),
@@ -55191,6 +55248,7 @@ var render = function () {
"button",
{
staticClass: "px-4 py-2 bg-blue-600 rounded ml-2",
attrs: { id: "buttonsearch" },
on: {
click: function ($event) {
return _vm.toggleDropdown()
@@ -72833,7 +72891,7 @@ if (typeof window !== 'undefined' && window.Vue) {
/***/ ((module) => {
"use strict";
module.exports = JSON.parse('{"_args":[["axios@0.21.4","C:\\\\laragon\\\\www\\\\adminpkb"]],"_development":true,"_from":"axios@0.21.4","_id":"axios@0.21.4","_inBundle":false,"_integrity":"sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==","_location":"/axios","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"axios@0.21.4","name":"axios","escapedName":"axios","rawSpec":"0.21.4","saveSpec":null,"fetchSpec":"0.21.4"},"_requiredBy":["#DEV:/"],"_resolved":"https://registry.npmjs.org/axios/-/axios-0.21.4.tgz","_spec":"0.21.4","_where":"C:\\\\laragon\\\\www\\\\adminpkb","author":{"name":"Matt Zabriskie"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"bugs":{"url":"https://github.com/axios/axios/issues"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}],"dependencies":{"follow-redirects":"^1.14.0"},"description":"Promise based HTTP client for the browser and node.js","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"homepage":"https://axios-http.com","jsdelivr":"dist/axios.min.js","keywords":["xhr","http","ajax","promise","node"],"license":"MIT","main":"index.js","name":"axios","repository":{"type":"git","url":"git+https://github.com/axios/axios.git"},"scripts":{"build":"NODE_ENV=production grunt build","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","examples":"node ./examples/server.js","fix":"eslint --fix lib/**/*.js","postversion":"git push && git push --tags","preversion":"npm test","start":"node ./sandbox/server.js","test":"grunt test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"},"typings":"./index.d.ts","unpkg":"dist/axios.min.js","version":"0.21.4"}');
module.exports = JSON.parse('{"_from":"axios@^0.21","_id":"axios@0.21.4","_inBundle":false,"_integrity":"sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==","_location":"/axios","_phantomChildren":{},"_requested":{"type":"range","registry":true,"raw":"axios@^0.21","name":"axios","escapedName":"axios","rawSpec":"^0.21","saveSpec":null,"fetchSpec":"^0.21"},"_requiredBy":["#DEV:/","#USER"],"_resolved":"https://registry.npmjs.org/axios/-/axios-0.21.4.tgz","_shasum":"c67b90dc0568e5c1cf2b0b858c43ba28e2eda575","_spec":"axios@^0.21","_where":"C:\\\\laragon\\\\www\\\\adminpkb","author":{"name":"Matt Zabriskie"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"bugs":{"url":"https://github.com/axios/axios/issues"},"bundleDependencies":false,"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}],"dependencies":{"follow-redirects":"^1.14.0"},"deprecated":false,"description":"Promise based HTTP client for the browser and node.js","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"homepage":"https://axios-http.com","jsdelivr":"dist/axios.min.js","keywords":["xhr","http","ajax","promise","node"],"license":"MIT","main":"index.js","name":"axios","repository":{"type":"git","url":"git+https://github.com/axios/axios.git"},"scripts":{"build":"NODE_ENV=production grunt build","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","examples":"node ./examples/server.js","fix":"eslint --fix lib/**/*.js","postversion":"git push && git push --tags","preversion":"npm test","start":"node ./sandbox/server.js","test":"grunt test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"},"typings":"./index.d.ts","unpkg":"dist/axios.min.js","version":"0.21.4"}');
/***/ })
+83 -27
View File
@@ -1,24 +1,24 @@
<template>
<div class="container w-full max-w-xl mx-auto mt-10 px-4 font-sans">
<form class="bg-white w-full shadow-md rounded-lg px-8 pt-6 pb-4 mb-4">
<form class="bg-white w-full shadow-md rounded-lg px-8 pt-6 pb-4 mb-4" onclick="return false">
<div class="mb-4 w-96 mx-auto">
<label class="block text-gray-500 font-medium text-sm mb-2">Pelanggan</label>
<div class="flex flex-wrap">
<div class="flex flex-row w-96 mx-auto">
<div class="flex flex-col w-96">
<input type="text" ref="btnDropdownRef" placeholder="Masukkan IC atau Nama" class="mr-2 bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-blue-500" />
<input id="frminput" type="text" ref="btnDropdownRef" placeholder="Masukkan IC atau Nama" class="mr-2 bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-blue-500" />
<div ref="popoverDropdownRef" v-bind:class="{'hidden': !dropdownShow, 'block': dropdownShow}" class="origin-top-right w-96 right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" role="menu" aria-orientation="vertical" aria-labelledby="menu-button" tabindex="-1">
<div class="py-1" role="none">
<a v-for="(cust,i) in arrayCustomer" :key="i" href="#" class="text-gray-700 block px-4 py-2 text-sm hover:bg-yellow-500" role="menuitem" tabindex="-1" id="menu-item-0">{{ cust.nama }}<br><b>{{ cust.kpbaru }}</b></a>
<a v-for="(cust,i) in arrayCustomer" :key="i" class="text-gray-700 block px-4 py-2 text-sm hover:bg-yellow-500" role="menuitem" tabindex="-1" id="menu-item-0">{{ cust.nama }}<br><b>{{ (cust.kpbaru) ? cust.kpbaru : cust.kplama }}</b></a>
<!-- <a href="#" class="text-gray-700 block px-4 py-2 text-sm hover:bg-yellow-500" role="menuitem" tabindex="-1" id="menu-item-1">MUHAMMAD HAFIFIE BIN ABD RAHMAN<br><b>970403035003</b></a>
<a href="#" class="text-gray-700 block px-4 py-2 text-sm hover:bg-yellow-500" role="menuitem" tabindex="-1" id="menu-item-2">MUHAMMAD HAFIFIE BIN ABD RAHMAN<br><b>970403035003</b></a> -->
</div>
</div>
</div>
<button class="px-4 py-2 bg-blue-600 rounded ml-2" v-on:click="toggleDropdown()"><i class="fas fa-search text-white"></i></button>
<button id="buttonsearch" class="px-4 py-2 bg-blue-600 rounded ml-2" v-on:click="toggleDropdown()"><i class="fas fa-search text-white"></i></button>
</div>
</div>
</div>
@@ -30,40 +30,96 @@
import { createPopper } from "@popperjs/core";
export default{
props: {
placement: {
type: String,
default: "bottom-start"
}
},
data() {
return {
dropdownShow: false,
arrayCustomer: []
}
},
computed:{
getData(){
let data = this.axios.get('http://localhost:8000/api/customers/630411035213').then(response => {
// this.arrayCustomer.push(response.data)
this.arrayCustomer = response.data
});
return data;
arrayCustomer: Object
}
},
mounted() {
document.addEventListener('click', this.onClick);
},
beforeDestroy() {
document.removeEventListener('click', this.onClick);
},
methods: {
toggleDropdown: function(){
toggleDropdown : function(){
if(this.dropdownShow){
this.dropdownShow = false;
} else {
this.dropdownShow = true;
createPopper(this.$refs.btnDropdownRef, this.$refs.popoverDropdownRef, {
placement: "bottom-start"
});
this.getData()
if(this.arrayCustomer.length > 0)
{
// if(this.dropdownShow){
// this.dropdownShow = false;
// } else {
this.dropdownShow = true;
createPopper(this.$refs.btnDropdownRef, this.$refs.popoverDropdownRef, {
placement: "bottom-start",
modifiers: [{
name: "preventOverflow",
}]
});
// }
}
},
getData: function() {
let inputvalue = document.getElementById("frminput").value;
if(inputvalue)
if(this.hasNumber(inputvalue))
{
this.axios.get('http://localhost:8000/admin/searchByIC', {
params: {
ic: inputvalue
}
}).then(response => {
this.arrayCustomer = response.data
}).catch(error => {
console.log(error)
})
}else{
this.axios.get('http://localhost:8000/admin/searchByName', {
params: {
nama: inputvalue
}
}).then(response => {
this.arrayCustomer = response.data
}).catch(error => {
console.log(error)
})
}
},
hasNumber: function(inputString){
return /\d/.test(inputString);
},
onClick: function(){
let isClickInside = this.$refs.popoverDropdownRef.contains(event.target);
let searchInside = this.$refs.btnDropdownRef.contains(event.target);
let buttonSearch = document.getElementById('buttonsearch');
if (isClickInside || searchInside || buttonSearch.contains(event.target)) {
if(buttonSearch.value !== '')
{
this.dropdownShow = true
}
}
else{
this.dropdownShow = false
this.arrayCustomer = []
}
}
}
}
</script>