From 1f2da63536f3ed886fd852c31c73e1a877c46771 Mon Sep 17 00:00:00 2001 From: fifi97 <46933637+fifi97@users.noreply.github.com> Date: Tue, 7 Dec 2021 10:39:41 +0800 Subject: [PATCH] fix ksit2 --- app/Http/Controllers/PelangganController.php | 14 +++ composer.json | 3 +- composer.lock | 68 +++++++++++- public/js/app.js | 76 ++++++++----- resources/js/app.js | 1 - resources/js/components/Searchpelanggan.vue | 85 +++++++++----- resources/views/layouts/app.blade.php | 3 + .../pelanggan/detailspelanggan.blade.php | 105 ++++++++++++++++++ resources/views/pelanggan/pelanggan.blade.php | 2 +- routes/web.php | 2 + 10 files changed, 297 insertions(+), 62 deletions(-) create mode 100644 resources/views/pelanggan/detailspelanggan.blade.php diff --git a/app/Http/Controllers/PelangganController.php b/app/Http/Controllers/PelangganController.php index a473b17..e5833ce 100644 --- a/app/Http/Controllers/PelangganController.php +++ b/app/Http/Controllers/PelangganController.php @@ -21,4 +21,18 @@ class PelangganController extends Controller return view('pelanggan.pelanggan',compact('api_url','cawangan_info','auth_user')); } + + public function DetailsPelanggan($id) + { + $api_url = config('api.url'); + $auth_user = Auth::user(); + + $cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); + $cawangan=Http::get(config('api.url').'/api/cawangan/detail/'.$auth_user['cawangan'])->json(); + $cawangan_detail=$cawangan[0]; + + $customer_info = Http::get(config('api.url') . '/api/customers/'. $id)->json(); + + return view('pelanggan.detailspelanggan',compact('api_url','cawangan_info','auth_user','customer_info')); + } } diff --git a/composer.json b/composer.json index 2ccfc30..af30526 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,8 @@ "laravel/framework": "^8.65", "laravel/sanctum": "^2.11", "laravel/tinker": "^2.5", - "laravel/ui": "^3.3" + "laravel/ui": "^3.3", + "tightenco/ziggy": "^1.4" }, "require-dev": { "facade/ignition": "^2.5", diff --git a/composer.lock b/composer.lock index ec990c9..0a64a20 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4e38664dc2e1313269ea0f10ec8cbadf", + "content-hash": "a4cb9fb7347683123d0da4b9a7a190d5", "packages": [ { "name": "asm89/stack-cors", @@ -5243,6 +5243,72 @@ ], "time": "2021-11-12T11:38:27+00:00" }, + { + "name": "tightenco/ziggy", + "version": "v1.4.2", + "source": { + "type": "git", + "url": "https://github.com/tighten/ziggy.git", + "reference": "620c135281062b9f6b53a75b07f99a4339267277" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tighten/ziggy/zipball/620c135281062b9f6b53a75b07f99a4339267277", + "reference": "620c135281062b9f6b53a75b07f99a4339267277", + "shasum": "" + }, + "require": { + "laravel/framework": ">=5.4@dev" + }, + "require-dev": { + "orchestra/testbench": "^6.0", + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Tightenco\\Ziggy\\ZiggyServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Tightenco\\Ziggy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Coulbourne", + "email": "daniel@tighten.co" + }, + { + "name": "Jake Bathman", + "email": "jake@tighten.co" + }, + { + "name": "Jacob Baker-Kretzmar", + "email": "jacob@tighten.co" + } + ], + "description": "Generates a Blade directive exporting all of your named Laravel routes. Also provides a nice route() helper function in JavaScript.", + "homepage": "https://github.com/tighten/ziggy", + "keywords": [ + "Ziggy", + "javascript", + "laravel", + "routes" + ], + "support": { + "issues": "https://github.com/tighten/ziggy/issues", + "source": "https://github.com/tighten/ziggy/tree/v1.4.2" + }, + "time": "2021-10-01T13:55:26+00:00" + }, { "name": "tijsverkoyen/css-to-inline-styles", "version": "2.2.3", diff --git a/public/js/app.js b/public/js/app.js index 8743104..9197d09 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -16982,8 +16982,6 @@ __webpack_require__.r(__webpack_exports__); // // // -// -// /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ props: { @@ -16995,6 +16993,7 @@ __webpack_require__.r(__webpack_exports__); data: function data() { return { dropdownShow: false, + param1: "", arrayCustomer: Object }; }, @@ -17009,42 +17008,44 @@ __webpack_require__.r(__webpack_exports__); 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", modifiers: [{ name: "preventOverflow" }] - }); // } + }); + } else { + console.log('siap'); } }, 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); - }); + + 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) { @@ -17060,9 +17061,22 @@ __webpack_require__.r(__webpack_exports__); this.dropdownShow = true; } } else { - this.dropdownShow = false; - this.arrayCustomer = []; + if (this.$refs.btnDropdownRef.value != '') { + this.dropdownShow = false; + } else { + this.dropdownShow = false; + this.arrayCustomer = []; + } } + }, + Urlredirect: function Urlredirect(options) { + // console.log(route().has('admin.detailspelanggan')) + // window.location.href = route('admin.detailspelanggan', options.cust); + // return route('admin.detailspelanggan', options.cust) + return window.route('admin.detailspelanggan', options.cust); + }, + ClickUrl: function ClickUrl(e) { + window.location.href = e.target.getAttribute('href'); } } }); @@ -55223,6 +55237,12 @@ var render = function () { role: "menuitem", tabindex: "-1", id: "menu-item-0", + href: _vm.Urlredirect({ cust: cust.kpbaru }), + }, + on: { + click: function ($event) { + return _vm.ClickUrl($event) + }, }, }, [ diff --git a/resources/js/app.js b/resources/js/app.js index 082b5b2..d833270 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -50,7 +50,6 @@ Vue.component('apexchart', VueApexCharts) - // Vue.component('Navbar', require('./components/Navbar.vue').default); diff --git a/resources/js/components/Searchpelanggan.vue b/resources/js/components/Searchpelanggan.vue index 1d7ce5c..d68ddfb 100644 --- a/resources/js/components/Searchpelanggan.vue +++ b/resources/js/components/Searchpelanggan.vue @@ -11,9 +11,7 @@ @@ -39,6 +37,7 @@ export default{ data() { return { dropdownShow: false, + param1: "", arrayCustomer: Object } }, @@ -49,15 +48,12 @@ export default{ document.removeEventListener('click', this.onClick); }, methods: { - toggleDropdown : function(){ + toggleDropdown : function() { 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", @@ -65,7 +61,8 @@ export default{ name: "preventOverflow", }] }); - // } + }else{ + console.log('siap') } }, @@ -74,29 +71,36 @@ export default{ 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) - }) + if(this.hasNumber(inputvalue)) + { + this.axios.get('http://localhost:8000/admin/searchByIC', { + params: { + ic: inputvalue + } + }).then(response => { + this.arrayCustomer = response.data - }else{ - this.axios.get('http://localhost:8000/admin/searchByName', { - params: { - nama: inputvalue + }).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) + }) } - }).then(response => { - this.arrayCustomer = response.data - }).catch(error => { - console.log(error) - }) } + }, hasNumber: function(inputString){ return /\d/.test(inputString); @@ -113,10 +117,31 @@ export default{ } } else{ - this.dropdownShow = false - this.arrayCustomer = [] + + if(this.$refs.btnDropdownRef.value != '') + { + this.dropdownShow = false + }else{ + this.dropdownShow = false + this.arrayCustomer = [] + } + } - } + }, + Urlredirect: function(options) { + + // console.log(route().has('admin.detailspelanggan')) + + // window.location.href = route('admin.detailspelanggan', options.cust); + + // return route('admin.detailspelanggan', options.cust) + return window.route('admin.detailspelanggan', options.cust) + }, + + ClickUrl: function(e){ + + window.location.href = e.target.getAttribute('href'); + } } diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index ec64764..6f951fd 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -9,6 +9,9 @@ Ar-Rahn Admin Page + + @routes + diff --git a/resources/views/pelanggan/detailspelanggan.blade.php b/resources/views/pelanggan/detailspelanggan.blade.php new file mode 100644 index 0000000..ab849ce --- /dev/null +++ b/resources/views/pelanggan/detailspelanggan.blade.php @@ -0,0 +1,105 @@ +@extends('layouts.app') + +@section('content') + +
+
+ +
+ + + + +
+
+
+ + +
+
+ + +
+
+
+
+ + +

Make it as long and as crazy as you'd like

+
+
+
+
+ + +
+
+ +
+ +
+ +
+
+
+
+ + +
+
+
+ +
+
+