diff --git a/app/Http/Controllers/KelulusanController.php b/app/Http/Controllers/KelulusanController.php index 5dd5de8..d37c3ff 100644 --- a/app/Http/Controllers/KelulusanController.php +++ b/app/Http/Controllers/KelulusanController.php @@ -6,6 +6,7 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Http; +use Illuminate\Support\Facades\Storage; use Carbon\Carbon; class KelulusanController extends Controller @@ -88,7 +89,7 @@ class KelulusanController extends Controller { $imageName = time().'.'.$request->image->extension(); - $request->image->move(public_path('kelulusanpb'), $imageName); + $request->image->move(public_path('storage\kelulusanpb'), $imageName); $updatelulus = Http::put(config('api.url') . '/admin/permohonan/updatepb',[ 'amaun_lulus' => $request->amaun_lulus, @@ -104,4 +105,9 @@ class KelulusanController extends Controller return response(1); } } + + public function download(Request $request) + { + return Storage::download('public/kelulusanpb/'.$request->image); + } } diff --git a/config/filesystems.php b/config/filesystems.php index 760ef97..123fe5d 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -38,7 +38,7 @@ return [ 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', + 'url' => env('APP_URL').'/public', 'visibility' => 'public', ], diff --git a/public/kelulusanpb/1649047154.webp b/public/kelulusanpb/1649047154.webp deleted file mode 100644 index 5be7112..0000000 Binary files a/public/kelulusanpb/1649047154.webp and /dev/null differ diff --git a/public/kelulusanpb/1649047155.webp b/public/kelulusanpb/1649047155.webp deleted file mode 100644 index 5be7112..0000000 Binary files a/public/kelulusanpb/1649047155.webp and /dev/null differ diff --git a/public/kelulusanpb/1649048144.png b/public/kelulusanpb/1649048144.png deleted file mode 100644 index 73ba943..0000000 Binary files a/public/kelulusanpb/1649048144.png and /dev/null differ diff --git a/public/kelulusanpb/1649048181.png b/public/kelulusanpb/1649048181.png deleted file mode 100644 index 73ba943..0000000 Binary files a/public/kelulusanpb/1649048181.png and /dev/null differ diff --git a/public/kelulusanpb/1649048256.jpg b/public/kelulusanpb/1649048256.jpg deleted file mode 100644 index 70ac5c4..0000000 Binary files a/public/kelulusanpb/1649048256.jpg and /dev/null differ diff --git a/public/kelulusanpb/1649049337.jpg b/public/kelulusanpb/1649049337.jpg deleted file mode 100644 index 609835e..0000000 Binary files a/public/kelulusanpb/1649049337.jpg and /dev/null differ diff --git a/public/kelulusanpb/1649049441.jpg b/public/kelulusanpb/1649049441.jpg deleted file mode 100644 index 609835e..0000000 Binary files a/public/kelulusanpb/1649049441.jpg and /dev/null differ diff --git a/resources/js/Permohonan/RekodMohon.vue b/resources/js/Permohonan/RekodMohon.vue index c93cc1f..553dec6 100644 --- a/resources/js/Permohonan/RekodMohon.vue +++ b/resources/js/Permohonan/RekodMohon.vue @@ -238,8 +238,8 @@ - @@ -320,254 +320,22 @@ export default { return 'Bayaran Balik' } }, - async funcbatal(mohonid) { - - let refer = this; - const { - value: katalaluan - } = await this.$swal({ - title: 'Masukkan Katalaluan Semula', - input: 'password', - inputPlaceholder: 'Katalaluan', - confirmButtonText: 'Hantar', - showCancelButton: true, - cancelButtonText: 'Batal', - allowOutsideClick: false - }) - - if (katalaluan !== undefined) - await this.axios.get('/mintasemulakelulusan', { - params: { - passsemula: katalaluan - } - }).then(response => { - - if (response.data === 1) { - - if (this.userroles === "operasi") { - this.axios.put(this.$hostname + '/admin/permohonan/updateoperasi', { - kelulusan: "Batal", - mohonid: mohonid, - namaoperasi: this.username - }).then(response => { - if (response.data === 1) { - this.$swal({ - icon: 'success', - title: 'Berjaya', - text: 'Berjaya mengemaskini maklumat pelanggan', - allowOutsideClick: false - }).then(function () { - refer.getSenaraiMohon(refer.currentPage); - }); - } else { - this.$swal({ - icon: 'warning', - title: 'Tidak Berjaya', - text: 'Data pelanggan tidak berjaya dikemaskini', - allowOutsideClick: false - }).then(function () { - refer.getSenaraiMohon(refer.currentPage); - }); - } - }); - } else if (this.userroles === "akaun") { - this.axios.put(this.$hostname + '/admin/permohonan/updateakaun', { - kelulusan: "Batal", - mohonid: mohonid, - namaakaun: this.username - }).then(response => { - if (response.data === 1) { - this.$swal({ - icon: 'success', - title: 'Berjaya', - text: 'Berjaya mengemaskini maklumat pelanggan', - allowOutsideClick: false - }).then(function () { - refer.getSenaraiMohon(refer.currentPage); - }); - } else { - this.$swal({ - icon: 'warning', - title: 'Tidak Berjaya', - text: 'Data pelanggan tidak berjaya dikemaskini', - allowOutsideClick: false - }).then(function () { - refer.getSenaraiMohon(refer.currentPage); - }); - } - }); - - } else { - - } - - } else { - this.$swal({ - icon: 'warning', - title: 'Tidak Berjaya', - text: 'Kata Laluan Yang Dimasukkan Salah!!', - allowOutsideClick: false - }).then(function () { - refer.getSenaraiMohon(refer.currentPage); - }); - } + DownloadBukti: function (image) { + axios.get("/api/check/muatturun?image=" + image, { + responseType: 'blob' + }) + .then(response => { + const url = window.URL.createObjectURL(new Blob([response.data])); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', image); + document.body.appendChild(link); + link.click(); + }) + .catch(e => { + console.log(e); }); - - }, - async funcsetuju(mohonid) { - - let refer = this; - const { - value: katalaluan - } = await this.$swal({ - title: 'Masukkan Katalaluan Semula', - input: 'password', - inputPlaceholder: 'Katalaluan', - confirmButtonText: 'Hantar', - showCancelButton: true, - cancelButtonText: 'Batal', - allowOutsideClick: false - }) - - if (katalaluan !== undefined) - await this.axios.get('/mintasemulakelulusan', { - params: { - passsemula: katalaluan - } - }).then(response => { - - if (response.data === 1) { - - if (this.userroles === "operasi") { - this.axios.put(this.$hostname + '/admin/permohonan/updateoperasi', { - kelulusan: 'Lulus', - mohonid: mohonid, - namaoperasi: this.username - }).then(response => { - if (response.data === 1) { - this.$swal({ - icon: 'success', - title: 'Berjaya', - text: 'Berjaya mengemaskini maklumat pelanggan', - allowOutsideClick: false - }).then(function () { - refer.getSenaraiMohon(refer.currentPage); - }); - - } else { - this.$swal({ - icon: 'warning', - title: 'Tidak Berjaya', - text: 'Data pelanggan tidak berjaya dikemaskini', - allowOutsideClick: false - }).then(function () { - refer.getSenaraiMohon(refer.currentPage); - }); - - } - }); - } else if (this.userroles === 'akaun') { - this.axios.put(this.$hostname + '/admin/permohonan/updateakaun', { - kelulusan: 'Lulus', - mohonid: mohonid, - namaakaun: this.username - }).then(response => { - if (response.data === 1) { - this.$swal({ - icon: 'success', - title: 'Berjaya', - text: 'Berjaya mengemaskini maklumat pelanggan', - allowOutsideClick: false - }).then(function () { - refer.getSenaraiMohon(refer.currentPage); - }); - - } else { - this.$swal({ - icon: 'warning', - title: 'Tidak Berjaya', - text: 'Data pelanggan tidak berjaya dikemaskini', - allowOutsideClick: false - }).then(function () { - refer.getSenaraiMohon(refer.currentPage); - }); - - } - }); - } else { - - } - - } else { - this.$swal({ - icon: 'warning', - title: 'Tidak Berjaya', - text: 'Kata Laluan Yang Dimasukkan Salah!!', - allowOutsideClick: false - }).then(function () { - getSenaraiMohon(this.currentPage); - }); - } - }); - }, - CetakanPB: function (caw, mid) { - let refer = this; - this.axios.put(this.$hostname + '/admin/permohonan/updatecetak', { - mohonid: mid, - namaprint: this.username - }).then(response => { - if (response.data === 1) { - this.$swal({ - icon: 'success', - title: 'Berjaya', - text: 'Cetakan Berjaya Dijana!', - allowOutsideClick: false - }).then(function () { - refer.getSenaraiMohon(refer.currentPage); - }); - - } else { - this.$swal({ - icon: 'warning', - title: 'Tidak Berjaya', - text: 'Cetakan Tidak Berjaya!', - allowOutsideClick: false - }).then(function () { - refer.getSenaraiMohon(refer.currentPage); - }); - - } - }); - - let route = window.route('permohonan.cetakanpb', { - _query: { - cawangan: caw, - mohonid: mid - }, - }); - window.open(route, '_blank') - }, - KelulusanPB: function (mid, mohon) { - this.$refs.modal.mohonid = mid; - this.$refs.modal.amaun_dimohon = mohon; - this.$refs.modal.showModal = true; - }, - DepositBank: function (mid) { - this.$refs.bankmodal.mohonid = mid; - this.$refs.bankmodal.showModal = true; - }, - DownloadBukti: function(){ - console.log('dassa'); } - // CetakanPenuh: function (caw, mid) { - // let route = window.route('permohonan.cetakanpenuh', { - // _query: { - // cawangan: caw, - // mohonid: mid - // }, - // }); - // window.open(route, '_blank') - // } } } diff --git a/routes/api.php b/routes/api.php index 105b502..933f6ce 100644 --- a/routes/api.php +++ b/routes/api.php @@ -28,6 +28,7 @@ Route::group(['prefix' => 'check'], function () { Route::put('/kelulusan/operasi', 'App\Http\Controllers\KelulusanController@updatekelulusan'); Route::post('/kelulusan/pb', 'App\Http\Controllers\KelulusanController@updatePB'); + Route::get('/muatturun', 'App\Http\Controllers\KelulusanController@download'); });