diff --git a/app/Events/NotifikasiPembayaran.php b/app/Events/NotifikasiPembayaran.php new file mode 100644 index 0000000..533f8b8 --- /dev/null +++ b/app/Events/NotifikasiPembayaran.php @@ -0,0 +1,30 @@ +message = $message; + } + + public function broadcastOn() + { + return ['notifikasi-pembayaran']; + } + + public function broadcastAs() + { + return 'trigger-pembayaran'; + } +} \ No newline at end of file diff --git a/app/Events/StatusLiked.php b/app/Events/StatusLiked.php new file mode 100644 index 0000000..8fa9c49 --- /dev/null +++ b/app/Events/StatusLiked.php @@ -0,0 +1,30 @@ +message = $message; + } + + public function broadcastOn() + { + return ['status-liked']; + } + + public function broadcastAs() + { + return 'my-event'; + } +} \ No newline at end of file diff --git a/app/Http/Controllers/GadaianController.php b/app/Http/Controllers/GadaianController.php index 85159f5..df906a9 100644 --- a/app/Http/Controllers/GadaianController.php +++ b/app/Http/Controllers/GadaianController.php @@ -159,4 +159,58 @@ class GadaianController extends Controller return view('print.sag',compact('gadai_detail','customer_detail','marhun_detail','cawangan_detail','api_url','pembayaran_segera')); } + + public function resit($id) + { + + $transaction = Http::get(config('api.url') . '/api/transaction/id/'. $id)->json(); + + if(sizeof($transaction) != 0) + $transaction = $transaction[0]; + + $gadai = Http::get(config('api.url') . '/api/gadai/norujukan/'. $transaction['norujukan'])->json(); + + if(sizeof($gadai) != 0) + $gadai = $gadai[0][0]; + + $customers_info = Http::get(config('api.url') . '/api/customers/'. $gadai['nokp'])->json(); + + if(sizeof($customers_info) != 0) + $customers_info = $customers_info[0]; + + return view('print.resitansuran',compact('transaction','gadai','customers_info')); + } + + public function history(Request $request) + { + $auth_user = Auth::user(); + + $gadai = Http::get(config('api.url') . '/api/gadai/norujukan/'. $request->norujukan)->json(); + + if(sizeof($gadai) > 0) + $history = $gadai[0][0]['historygadaian']; + + $count = 0; + $arrayhist = []; + + while($history != "0" && $history != '') + { + $gadai = Http::get(config('api.url') . '/api/gadai/norujukan/'. $history)->json(); + + $tebus = Http::get(config('api.url') . '/api/listpenebusanhistory/'. $auth_user['cawangan'],[ + "norujukan" => $history + ])->json(); + + array_push($arrayhist,["norujukan" => $history,"jenistebus" => $tebus[0]['jenistebus'],"jbg" => $tebus[0]['jbg'],"t_tebus" => $tebus[0]['t_tebus']]); + + if(sizeof($gadai) > 0) + $history = $gadai[0][0]['historygadaian']; + + $count++; + } + + return response()->json($arrayhist,200); + } + + } diff --git a/app/Http/Controllers/KhazanahController.php b/app/Http/Controllers/KhazanahController.php index 5de23d4..4484bd6 100644 --- a/app/Http/Controllers/KhazanahController.php +++ b/app/Http/Controllers/KhazanahController.php @@ -2,6 +2,11 @@ namespace App\Http\Controllers; +//Events +use App\Events\StatusLiked; +use App\Events\NotifikasiPembayaran; + + use App\User; use App\Cawangan; @@ -302,6 +307,8 @@ class KhazanahController extends Controller // 'teller' => $request->teller ])->json(); + event(new StatusLiked('Penghantaran kepada Khazanah!')); + return response()->json($createlulus,201); } @@ -341,6 +348,8 @@ class KhazanahController extends Controller $auth_user = Auth::user(); $gadai = Http::put(config('api.url').'/api/gadai/serah_marhun/khazanah/'. $auth_user['cawangan'] .'/' . $request->norujukan_barcode)->json(); + event(new NotifikasiPembayaran('TellerkepadaKhazanah')); + return redirect()->route('khazanah.gadaian'); } diff --git a/app/Http/Controllers/PenebusanController.php b/app/Http/Controllers/PenebusanController.php index 7f0a8f1..c4ffcaa 100644 --- a/app/Http/Controllers/PenebusanController.php +++ b/app/Http/Controllers/PenebusanController.php @@ -112,6 +112,16 @@ class PenebusanController extends Controller 'kuantiti_marhun' => $request->kuantiti_marhun ])->json(); + + //////////////////////////// + ////Update History Gadaian/// + //////////////////////////// + + $updatehistorygadaian = Http::put(config('api.url').'/api/gadai/updatehistory/'. $auth_user['cawangan'] .'/' . $norujukanbaru,[ + 'historygadaian' => $request->norujukan + ])->json(); + + /////////////////////////// /// MARHUN UPDATE TABLE//// ////////////////////////// @@ -221,6 +231,15 @@ class PenebusanController extends Controller 'kuantiti_marhun' => $request->kuantiti_marhun ])->json(); + //////////////////////////// + ////Update History Gadaian/// + //////////////////////////// + + $updatehistorygadaian = Http::put(config('api.url').'/api/gadai/updatehistory/'. $auth_user['cawangan'] .'/' . $norujukanbaru,[ + 'historygadaian' => $request->norujukan + ])->json(); + + /////////////////////////// /// MARHUN UPDATE TABLE//// ////////////////////////// @@ -298,7 +317,6 @@ class PenebusanController extends Controller $new_transaction = sprintf("%04d",$new_sirig); $norujukanbaru = strtoupper($auth_user['cawangan']) . $curent_year . $curent_month . $current_day . '-' .$new_transaction; - // dd($norujukan); $gadai = Http::post(config('api.url').'/api/gadai/'.$auth_user['cawangan'],[ 'norujukan' => $norujukanbaru, 'nopelanggan' => $request->nopelanggan, @@ -306,7 +324,7 @@ class PenebusanController extends Controller 'sirig' => $new_sirig ]); - + ////////////////////// ////Update SAG BARU/// ///////////////////// @@ -334,7 +352,16 @@ class PenebusanController extends Controller 'kuantiti_marhun' => $request->kuantiti_marhun ])->json(); + //////////////////////////// + ////Update History Gadaian/// + //////////////////////////// + $updatehistorygadaian = Http::put(config('api.url').'/api/gadai/updatehistory/'. $auth_user['cawangan'] .'/' . $norujukanbaru,[ + 'historygadaian' => $request->norujukan + ])->json(); + + + dd($updatehistorygadaian); /////////////////////////// /// MARHUN UPDATE TABLE//// diff --git a/composer.json b/composer.json index 0b99b06..b7aba5a 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,7 @@ "laravel/tinker": "^2.0", "laravel/ui": "^2.4", "milon/barcode": "^7.0", + "pusher/pusher-php-server": "~4.0", "simplesoftwareio/simple-qrcode": "^4.1", "spatie/laravel-medialibrary": "^7.19", "yajra/laravel-datatables-oracle": "^9.11" diff --git a/composer.lock b/composer.lock index f8100ec..421ea39 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": "96633471a3eefd7748e7eb9ba32f99f2", + "content-hash": "b79f8c1e1e1c9dc9c91b67320e3cf3ea", "packages": [ { "name": "almasaeed2010/adminlte", @@ -2368,6 +2368,142 @@ }, "time": "2020-09-23T05:00:00+00:00" }, + { + "name": "paragonie/random_compat", + "version": "v9.99.100", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", + "shasum": "" + }, + "require": { + "php": ">= 7" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "polyfill", + "pseudorandom", + "random" + ], + "support": { + "email": "info@paragonie.com", + "issues": "https://github.com/paragonie/random_compat/issues", + "source": "https://github.com/paragonie/random_compat" + }, + "time": "2020-10-15T08:29:30+00:00" + }, + { + "name": "paragonie/sodium_compat", + "version": "v1.14.0", + "source": { + "type": "git", + "url": "https://github.com/paragonie/sodium_compat.git", + "reference": "a1cfe0b21faf9c0b61ac0c6188c4af7fd6fd0db3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/a1cfe0b21faf9c0b61ac0c6188c4af7fd6fd0db3", + "reference": "a1cfe0b21faf9c0b61ac0c6188c4af7fd6fd0db3", + "shasum": "" + }, + "require": { + "paragonie/random_compat": ">=1", + "php": "^5.2.4|^5.3|^5.4|^5.5|^5.6|^7|^8" + }, + "require-dev": { + "phpunit/phpunit": "^3|^4|^5|^6|^7|^8|^9" + }, + "suggest": { + "ext-libsodium": "PHP < 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security.", + "ext-sodium": "PHP >= 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security." + }, + "type": "library", + "autoload": { + "files": [ + "autoload.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com" + }, + { + "name": "Frank Denis", + "email": "jedisct1@pureftpd.org" + } + ], + "description": "Pure PHP implementation of libsodium; uses the PHP extension if it exists", + "keywords": [ + "Authentication", + "BLAKE2b", + "ChaCha20", + "ChaCha20-Poly1305", + "Chapoly", + "Curve25519", + "Ed25519", + "EdDSA", + "Edwards-curve Digital Signature Algorithm", + "Elliptic Curve Diffie-Hellman", + "Poly1305", + "Pure-PHP cryptography", + "RFC 7748", + "RFC 8032", + "Salpoly", + "Salsa20", + "X25519", + "XChaCha20-Poly1305", + "XSalsa20-Poly1305", + "Xchacha20", + "Xsalsa20", + "aead", + "cryptography", + "ecdh", + "elliptic curve", + "elliptic curve cryptography", + "encryption", + "libsodium", + "php", + "public-key cryptography", + "secret-key cryptography", + "side-channel resistant" + ], + "support": { + "issues": "https://github.com/paragonie/sodium_compat/issues", + "source": "https://github.com/paragonie/sodium_compat/tree/v1.14.0" + }, + "time": "2020-12-03T16:26:19+00:00" + }, { "name": "phenx/php-font-lib", "version": "0.5.2", @@ -2855,6 +2991,64 @@ }, "time": "2020-12-04T02:51:30+00:00" }, + { + "name": "pusher/pusher-php-server", + "version": "v4.1.5", + "source": { + "type": "git", + "url": "https://github.com/pusher/pusher-http-php.git", + "reference": "251f22602320c1b1aff84798fe74f3f7ee0504a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pusher/pusher-http-php/zipball/251f22602320c1b1aff84798fe74f3f7ee0504a9", + "reference": "251f22602320c1b1aff84798fe74f3f7ee0504a9", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "paragonie/sodium_compat": "^1.6", + "php": "^7.1|^8.0", + "psr/log": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.2|^8.5|^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Pusher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Library for interacting with the Pusher REST API", + "keywords": [ + "events", + "messaging", + "php-pusher-server", + "publish", + "push", + "pusher", + "real time", + "real-time", + "realtime", + "rest", + "trigger" + ], + "support": { + "issues": "https://github.com/pusher/pusher-http-php/issues", + "source": "https://github.com/pusher/pusher-http-php/tree/v4.1.5" + }, + "time": "2020-12-09T09:38:19+00:00" + }, { "name": "ralouphie/getallheaders", "version": "3.0.3", diff --git a/config/broadcasting.php b/config/broadcasting.php index 3bba110..7e082cd 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -36,8 +36,8 @@ return [ 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ - 'cluster' => env('PUSHER_APP_CLUSTER'), - 'useTLS' => true, + 'cluster' => 'ap1', + 'useTLS' => true ], ], diff --git a/resources/js/bootstrap.js b/resources/js/bootstrap.js index 63605fa..937d7b9 100644 --- a/resources/js/bootstrap.js +++ b/resources/js/bootstrap.js @@ -29,13 +29,13 @@ window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; * allows your team to easily build robust real-time web applications. */ -// import Echo from 'laravel-echo'; +import Echo from 'laravel-echo'; -// window.Pusher = require('pusher-js'); +window.Pusher = require('pusher-js'); -// window.Echo = new Echo({ -// broadcaster: 'pusher', -// key: process.env.MIX_PUSHER_APP_KEY, -// cluster: process.env.MIX_PUSHER_APP_CLUSTER, -// forceTLS: true -// }); +window.Echo = new Echo({ + broadcaster: 'pusher', + key: '26b0ec2f297f94b7aa9b', + cluster: 'ap1', + forceTLS: true +}); diff --git a/resources/views/customers/info.blade.php b/resources/views/customers/info.blade.php index fc49373..8abab51 100644 --- a/resources/views/customers/info.blade.php +++ b/resources/views/customers/info.blade.php @@ -1,4 +1,6 @@ @extends('layouts.app') + +@include('modal.historytebus')
+ +