diff --git a/R.jpeg b/R.jpeg new file mode 100644 index 0000000..caca436 Binary files /dev/null and b/R.jpeg differ diff --git a/resources/views/Admin/index.blade.php b/resources/views/Admin/index.blade.php index 16cc885..e534d7c 100644 --- a/resources/views/Admin/index.blade.php +++ b/resources/views/Admin/index.blade.php @@ -172,10 +172,13 @@
{{ $user->nama_lengkap }}
+ total_transaksi_berhasil + $user->total_refund_berhasil); + ?>
+ data-width="{{ $divided == 0 ? '1' : ($floatval($user->total_transaksi_berhasil) * 100) / $divided }}%">
Rp {{ number_format($user->total_transaksi_berhasil, 2, ',', '.') }} @@ -183,7 +186,7 @@
+ data-width="{{ $divided == 0 ? '1' : ($floatval($user->total_transaksi_berhasil) * 100) / $divided }}%">
Rp {{ number_format($user->total_refund_berhasil, 2, ',', '.') }} diff --git a/resources/views/Admin/refund/detail-refund.blade.php b/resources/views/Admin/refund/detail-refund.blade.php index 39aa432..6c47a0d 100644 --- a/resources/views/Admin/refund/detail-refund.blade.php +++ b/resources/views/Admin/refund/detail-refund.blade.php @@ -69,11 +69,13 @@

Total Bayar
-
{{ $refund->transaction->total_bayar }}
+
Rp {{ number_format($refund->transaction->total_bayar, 2, ',', '.') }} +

Total Refund
-
{{ $refund->transaction->total_harga }}
+
Rp {{ number_format($refund->transaction->total_harga, 2, ',', '.') }} +

Batas Pengajuan Refund
diff --git a/resources/views/Admin/transaction/detail-transaction.blade.php b/resources/views/Admin/transaction/detail-transaction.blade.php index 769f701..ff8051d 100644 --- a/resources/views/Admin/transaction/detail-transaction.blade.php +++ b/resources/views/Admin/transaction/detail-transaction.blade.php @@ -247,9 +247,9 @@
@endif
- + Invoice
@@ -430,11 +430,6 @@ } }); }); - - $('#btnPDF').on('click', function() { - const id = $(this).data('id'); - location.href = "{{ route('invoice.get', ':id') }}".replace(':id', id); - }); }); @endsection diff --git a/resources/views/Admin/users/detail-user.blade.php b/resources/views/Admin/users/detail-user.blade.php index 46c63ab..5dbd623 100644 --- a/resources/views/Admin/users/detail-user.blade.php +++ b/resources/views/Admin/users/detail-user.blade.php @@ -19,12 +19,12 @@
- @if ($user->foto_profil == null) + @if ($user->foto_profile == null) @else - @endif diff --git a/resources/views/User/refund/detail-refund.blade.php b/resources/views/User/refund/detail-refund.blade.php index d5900b1..cb5e92f 100644 --- a/resources/views/User/refund/detail-refund.blade.php +++ b/resources/views/User/refund/detail-refund.blade.php @@ -43,8 +43,22 @@

-
Total
-
{{ $refund->total }}
+
Harga Satuan Barang
+
{{ $refund->transaction->satuan_barang }}
+

+
+
Jumlah Barang
+
{{ $refund->transaction->jumlah_barang }}
+

+
+
Total Bayar
+
Rp {{ number_format($refund->transaction->total_bayar, 2, ',', '.') }} +
+

+
+
Total Refund
+
Rp {{ number_format($refund->transaction->total_harga, 2, ',', '.') }} +

Batas Pengajuan Refund
diff --git a/resources/views/User/transaction/Pembeli/detail-transaction.blade.php b/resources/views/User/transaction/Pembeli/detail-transaction.blade.php index 7a85ec9..c0cdb39 100644 --- a/resources/views/User/transaction/Pembeli/detail-transaction.blade.php +++ b/resources/views/User/transaction/Pembeli/detail-transaction.blade.php @@ -237,6 +237,11 @@

+
+ Invoice +
diff --git a/server python/ocr.py b/server python/ocr.py index 8b4e2ef..8802251 100644 --- a/server python/ocr.py +++ b/server python/ocr.py @@ -12,42 +12,41 @@ app = Flask(__name__) @app.route('/', methods=['GET']) def hello(): - pesan = request.args.get('pesan') - return jsonify({'response': 'Hello, Flask! '+pesan}) + return jsonify({'response': 'Hello, Flask!'}) -@app.route('/test-form', methods=['POST']) -def test_form(): - nama = request.form['nama'] - return jsonify({'response': f'Halo, {nama}!'}) +# @app.route('/test-form', methods=['POST']) +# def test_form(): +# nama = request.form['nama'] +# return jsonify({'response': f'Halo, {nama}!'}) -@app.route('/test-form-image', methods=['POST']) -def test_form_image(): - # image = request.form['image'] - # all_data = {**request.args.to_dict(), **request.form.to_dict(), - # **request.files.to_dict()} - # return jsonify(request.files) - if 'image' in request.files: - uploaded_file = request.files['image'] - # Melihat informasi tentang file - # print(f"File Name: {uploaded_file.filename}") - # print(f"Content Type: {uploaded_file.content_type}") - if uploaded_file.filename == '': - return 'No selected file' +# @app.route('/test-form-image', methods=['POST']) +# def test_form_image(): +# # image = request.form['image'] +# # all_data = {**request.args.to_dict(), **request.form.to_dict(), +# # **request.files.to_dict()} +# # return jsonify(request.files) +# if 'image' in request.files: +# uploaded_file = request.files['image'] +# # Melihat informasi tentang file +# # print(f"File Name: {uploaded_file.filename}") +# # print(f"Content Type: {uploaded_file.content_type}") +# if uploaded_file.filename == '': +# return 'No selected file' - # Mendapatkan lokasi dari file Python yang sedang berjalan - current_directory = os.path.dirname(os.path.abspath(__file__)) - uploaded_file.save(os.path.join( - current_directory, uploaded_file.filename)) +# # Mendapatkan lokasi dari file Python yang sedang berjalan +# current_directory = os.path.dirname(os.path.abspath(__file__)) +# uploaded_file.save(os.path.join( +# current_directory, uploaded_file.filename)) - return 'File berhasil diunggah dan disimpan!' - # Anda dapat melakukan operasi lain di sini dengan file yang diunggah - # Misalnya, menyimpannya ke sistem file dengan: - # uploaded_file.save('lokasi_direktori_dan_nama_file_yang_diinginkan') - # return 'File berhasil diunggah!' - else: - return 'Tidak ada file yang diunggah!' +# return 'File berhasil diunggah dan disimpan!' +# # Anda dapat melakukan operasi lain di sini dengan file yang diunggah +# # Misalnya, menyimpannya ke sistem file dengan: +# # uploaded_file.save('lokasi_direktori_dan_nama_file_yang_diinginkan') +# # return 'File berhasil diunggah!' +# else: +# return 'Tidak ada file yang diunggah!' @app.route('/process-image', methods=['POST']) @@ -57,9 +56,10 @@ def process_image(): if uploaded_file.filename == '': return 'Tidak ada File yang dipih' - current_directory = os.path.dirname(os.path.abspath(__file__)) - uploaded_file.save(os.path.join( - current_directory, uploaded_file.filename)) + current_directory = os.getcwd() + file_directory = os.path.join( + current_directory, uploaded_file.filename) + uploaded_file.save(file_directory) else: return 'Tidak ada file yang diunggah!' @@ -69,7 +69,7 @@ def process_image(): # Simpan hasil dalam variabel `result` # Membaca gambar dengan OpenCV - image = open(uploaded_file.filename, "rb") + image = open(file_directory, "rb") image_data = image.read() image_array = bytearray(image_data) nparr = np.frombuffer(image_array, np.uint8) @@ -86,20 +86,9 @@ def process_image(): hasil = result.split("\n") - # (5) Normalize - for word in result.split("\n"): - if "”—" in word: - word = word.replace("”—", ":") + if os.path.exists(file_directory): + os.remove(file_directory) - # normalize NIK - if "NIK" in word: - nik_char = word.split() - if "D" in word: - word = word.replace("D", "0") - if "?" in word: - word = word.replace("?", "7") - - # print(word) return jsonify({'status': 'Berhasil', 'result': hasil}) else: return jsonify({'error': 'No image uploaded'}) @@ -107,38 +96,3 @@ def process_image(): # return jsonify(word) except Exception as e: return jsonify(error=str(e)) - - -if __name__ == '__main__': - app.run(host='localhost', port=8888, debug=False) - -# image = open("R.jpeg", "rb") - -# image_data = image.read() -# image_array = bytearray(image_data) -# nparr = np.frombuffer(image_array, np.uint8) -# img_cv2 = cv2.imdecode(nparr, cv2.IMREAD_COLOR) - -# # read img -# gray = cv2.cvtColor(img_cv2, cv2.COLOR_BGR2GRAY) - -# # (2) Threshold -# th, threshed = cv2.threshold(gray, 127, 255, cv2.THRESH_TRUNC) - -# # (3) Detect -# result = pytesseract.image_to_string((threshed), lang="ind") -# print(result) -# # (5) Normalize -# for word in result.split("\n"): -# if "”—" in word: -# word = word.replace("”—", ":") - -# # normalize NIK -# if "NIK" in word: -# nik_char = word.split() -# if "D" in word: -# word = word.replace("D", "0") -# if "?" in word: -# word = word.replace("?", "7") - -# print(word)