├── public ├── favicon.ico ├── robots.txt ├── js │ ├── landing.js │ ├── profile.js │ ├── edit_order_proof.js │ ├── transaction.js │ ├── datatables-simple.js │ ├── transaction_table.js │ ├── customers_table.js │ ├── image_preview.js │ ├── point.js │ ├── scripts.js │ ├── review.js │ └── product.js ├── .htaccess ├── css │ ├── point.css │ ├── profile.css │ └── landing.css └── index.php ├── resources ├── css │ └── app.css ├── js │ ├── app.js │ └── bootstrap.js └── views │ ├── partials │ ├── main_css.blade.php │ ├── footer.blade.php │ ├── breadcumb.blade.php │ ├── order │ │ ├── blank_data.blade.php │ │ ├── filter.blade.php │ │ ├── reject_order_modal.blade.php │ │ ├── transaction_proof_upload_modal.blade.php │ │ └── order_lists.blade.php │ ├── topbar.blade.php │ ├── product │ │ └── product_detail_modal.blade.php │ ├── sidebar.blade.php │ ├── review │ │ └── edit_review_modal.blade.php │ └── home │ │ └── home_admin.blade.php │ ├── home │ ├── index.blade.php │ └── customers.blade.php │ ├── landing │ └── index.blade.php │ ├── order │ └── order_data.blade.php │ ├── layouts │ ├── auth.blade.php │ └── main.blade.php │ ├── point │ └── user_point.blade.php │ ├── transaction │ ├── index.blade.php │ └── add_outcome.blade.php │ ├── auth │ └── login.blade.php │ ├── profile │ ├── change_password.blade.php │ └── my_profile.blade.php │ └── product │ └── index.blade.php ├── database ├── .gitignore ├── seeders │ ├── RoleSeeder.php │ ├── PaymentSeeder.php │ ├── CategorySeeder.php │ ├── DatabaseSeeder.php │ ├── StatusSeeder.php │ ├── BankSeeder.php │ ├── NoteSeeder.php │ └── UserSeeder.php ├── migrations │ ├── 2022_08_01_022935_create_roles_table.php │ ├── 2022_08_05_142213_create_notes_table.php │ ├── 2022_08_05_142158_create_payments_table.php │ ├── 2022_08_12_090054_create_categories_table.php │ ├── 2022_08_05_142234_create_statuses_table.php │ ├── 2022_08_05_142133_create_banks_table.php │ ├── 2022_08_09_132544_create_transactions_table.php │ ├── 2022_08_11_132444_create_reviews_table.php │ ├── 2022_08_02_142955_create_products_table.php │ ├── 2022_07_31_034300_create_users_table.php │ └── 2022_08_05_141036_create_orders_table.php └── factories │ └── UserFactory.php ├── bootstrap ├── cache │ └── .gitignore └── app.php ├── storage ├── logs │ └── .gitignore ├── app │ ├── public │ │ ├── .gitignore │ │ ├── home │ │ │ ├── coffee.jpg │ │ │ ├── hero-bg.png │ │ │ └── laracoffee.jpg │ │ ├── icons │ │ │ ├── online-banking.png │ │ │ ├── cash-on-delivery.png │ │ │ ├── close-icon.svg │ │ │ ├── angle-down.svg │ │ │ ├── bank-mandiri.svg │ │ │ └── bank-bri.svg │ │ ├── lotties │ │ │ └── loading-animation.gif │ │ ├── landing │ │ │ └── landing-background.jpg │ │ ├── product │ │ │ ├── Gy6UVqa000obrsMGJaRAzZ4hWEz5WGhu38QawLzC.jpg │ │ │ ├── gaamRDJEO5xNbQMfgSXx91ZNIVYxid2S110yVkKg.jpg │ │ │ ├── r8e0iS6hEBocNNBRkmTy5uL7BUf9IjNSQmZrgKJy.jpg │ │ │ └── sPISped9AR4XyNKlkSpiUyo7OkcJj8mSBmPuF6Ky.png │ │ └── profile │ │ │ └── cV8nuMT7VBfYYtANwUxegJ366XDbw0nXdxLEvehk.jpg │ └── .gitignore ├── debugbar │ └── .gitignore ├── framework │ ├── testing │ │ └── .gitignore │ ├── views │ │ └── .gitignore │ ├── cache │ │ ├── data │ │ │ └── .gitignore │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ └── .gitignore └── assets │ ├── User │ ├── home.PNG │ ├── product.PNG │ ├── profile.PNG │ ├── edit_order.PNG │ ├── order_list.PNG │ ├── user_point.PNG │ ├── authentication.PNG │ ├── edit_profile.PNG │ ├── make_an_order.PNG │ ├── order_detail.PNG │ ├── product_detail.PNG │ ├── registration.PNG │ ├── submit_review.PNG │ └── upload_bukti.PNG │ └── Admin │ ├── product.PNG │ ├── dashboard.PNG │ ├── add_product.PNG │ ├── detail_order.PNG │ ├── edit_product.PNG │ ├── history_order.PNG │ ├── transactions.PNG │ └── customer_lists.PNG ├── tests ├── TestCase.php ├── Unit │ └── ExampleTest.php ├── Feature │ └── ExampleTest.php └── CreatesApplication.php ├── .gitattributes ├── .gitignore ├── app ├── Models │ ├── Category.php │ ├── Bank.php │ ├── Note.php │ ├── Payment.php │ ├── Status.php │ ├── Transaction.php │ ├── Role.php │ ├── Product.php │ ├── Review.php │ ├── Order.php │ └── User.php ├── Http │ ├── Middleware │ │ ├── EncryptCookies.php │ │ ├── VerifyCsrfToken.php │ │ ├── PreventRequestsDuringMaintenance.php │ │ ├── TrustHosts.php │ │ ├── TrimStrings.php │ │ ├── AlreadyLogin.php │ │ ├── Authenticate.php │ │ ├── TrustProxies.php │ │ └── RedirectIfAuthenticated.php │ ├── Controllers │ │ ├── Controller.php │ │ ├── HomeController.php │ │ ├── PointController.php │ │ ├── TransactionController.php │ │ ├── AuthController.php │ │ ├── RajaOngkirController.php │ │ ├── ReviewController.php │ │ ├── ProfileController.php │ │ └── ProductController.php │ └── Kernel.php ├── Providers │ ├── BroadcastServiceProvider.php │ ├── AppServiceProvider.php │ ├── EventServiceProvider.php │ ├── AuthServiceProvider.php │ └── RouteServiceProvider.php ├── Policies │ ├── ProductPolicy.php │ ├── PointPolicy.php │ ├── ReviewPolicy.php │ └── OrderPolicy.php ├── helpers.php ├── Console │ └── Kernel.php └── Exceptions │ └── Handler.php ├── .editorconfig ├── package.json ├── vite.config.js ├── lang └── en │ ├── pagination.php │ ├── auth.php │ └── passwords.php ├── routes ├── channels.php ├── api.php └── console.php ├── config ├── cors.php ├── services.php ├── view.php ├── hashing.php ├── broadcasting.php ├── sanctum.php ├── filesystems.php ├── queue.php ├── cache.php ├── mail.php └── auth.php ├── LICENSE ├── phpunit.xml ├── .env.example ├── artisan └── composer.json /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/css/app.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import './bootstrap'; 2 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/debugbar/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | 4 | -- hehe buoi -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/assets/User/home.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/User/home.PNG -------------------------------------------------------------------------------- /storage/assets/Admin/product.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/Admin/product.PNG -------------------------------------------------------------------------------- /storage/assets/User/product.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/User/product.PNG -------------------------------------------------------------------------------- /storage/assets/User/profile.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/User/profile.PNG -------------------------------------------------------------------------------- /storage/app/public/home/coffee.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/app/public/home/coffee.jpg -------------------------------------------------------------------------------- /storage/app/public/home/hero-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/app/public/home/hero-bg.png -------------------------------------------------------------------------------- /storage/assets/Admin/dashboard.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/Admin/dashboard.PNG -------------------------------------------------------------------------------- /storage/assets/User/edit_order.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/User/edit_order.PNG -------------------------------------------------------------------------------- /storage/assets/User/order_list.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/User/order_list.PNG -------------------------------------------------------------------------------- /storage/assets/User/user_point.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/User/user_point.PNG -------------------------------------------------------------------------------- /storage/app/public/home/laracoffee.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/app/public/home/laracoffee.jpg -------------------------------------------------------------------------------- /storage/assets/Admin/add_product.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/Admin/add_product.PNG -------------------------------------------------------------------------------- /storage/assets/Admin/detail_order.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/Admin/detail_order.PNG -------------------------------------------------------------------------------- /storage/assets/Admin/edit_product.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/Admin/edit_product.PNG -------------------------------------------------------------------------------- /storage/assets/Admin/history_order.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/Admin/history_order.PNG -------------------------------------------------------------------------------- /storage/assets/Admin/transactions.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/Admin/transactions.PNG -------------------------------------------------------------------------------- /storage/assets/User/authentication.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/User/authentication.PNG -------------------------------------------------------------------------------- /storage/assets/User/edit_profile.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/User/edit_profile.PNG -------------------------------------------------------------------------------- /storage/assets/User/make_an_order.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/User/make_an_order.PNG -------------------------------------------------------------------------------- /storage/assets/User/order_detail.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/User/order_detail.PNG -------------------------------------------------------------------------------- /storage/assets/User/product_detail.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/User/product_detail.PNG -------------------------------------------------------------------------------- /storage/assets/User/registration.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/User/registration.PNG -------------------------------------------------------------------------------- /storage/assets/User/submit_review.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/User/submit_review.PNG -------------------------------------------------------------------------------- /storage/assets/User/upload_bukti.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/User/upload_bukti.PNG -------------------------------------------------------------------------------- /storage/assets/Admin/customer_lists.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/assets/Admin/customer_lists.PNG -------------------------------------------------------------------------------- /storage/app/public/icons/online-banking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/app/public/icons/online-banking.png -------------------------------------------------------------------------------- /storage/app/public/icons/cash-on-delivery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/app/public/icons/cash-on-delivery.png -------------------------------------------------------------------------------- /storage/app/public/lotties/loading-animation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/app/public/lotties/loading-animation.gif -------------------------------------------------------------------------------- /storage/app/public/landing/landing-background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/app/public/landing/landing-background.jpg -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | compiled.php 2 | config.php 3 | down 4 | events.scanned.php 5 | maintenance.php 6 | routes.php 7 | routes.scanned.php 8 | schedule-* 9 | services.json 10 | -------------------------------------------------------------------------------- /storage/app/public/product/Gy6UVqa000obrsMGJaRAzZ4hWEz5WGhu38QawLzC.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/app/public/product/Gy6UVqa000obrsMGJaRAzZ4hWEz5WGhu38QawLzC.jpg -------------------------------------------------------------------------------- /storage/app/public/product/gaamRDJEO5xNbQMfgSXx91ZNIVYxid2S110yVkKg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/app/public/product/gaamRDJEO5xNbQMfgSXx91ZNIVYxid2S110yVkKg.jpg -------------------------------------------------------------------------------- /storage/app/public/product/r8e0iS6hEBocNNBRkmTy5uL7BUf9IjNSQmZrgKJy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/app/public/product/r8e0iS6hEBocNNBRkmTy5uL7BUf9IjNSQmZrgKJy.jpg -------------------------------------------------------------------------------- /storage/app/public/product/sPISped9AR4XyNKlkSpiUyo7OkcJj8mSBmPuF6Ky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/app/public/product/sPISped9AR4XyNKlkSpiUyo7OkcJj8mSBmPuF6Ky.png -------------------------------------------------------------------------------- /storage/app/public/profile/cV8nuMT7VBfYYtANwUxegJ366XDbw0nXdxLEvehk.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snykk/Laracoffee/HEAD/storage/app/public/profile/cV8nuMT7VBfYYtANwUxegJ366XDbw0nXdxLEvehk.jpg -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | 3 | {{-- bootstrap icon --}} 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.blade.php diff=html 4 | *global.css linguist-vendored 5 | *auth.css linguist-vendored 6 | *.html diff=html 7 | *.md diff=markdown 8 | *.php diff=php 9 | 10 | /.github export-ignore 11 | CHANGELOG.md export-ignore 12 | .styleci.yml export-ignore 13 | -------------------------------------------------------------------------------- /public/js/profile.js: -------------------------------------------------------------------------------- 1 | import { previewImage } from "/js/image_preview.js"; 2 | 3 | $("#image").on("change", function () { 4 | previewImage({ 5 | image: "image", 6 | image_preview: "image-preview", 7 | image_preview_alt: "Profile Image", 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/build 3 | /public/hot 4 | /public/storage 5 | /storage/*.key 6 | /vendor 7 | .env 8 | .env.backup 9 | .phpunit.result.cache 10 | Homestead.json 11 | Homestead.yaml 12 | auth.json 13 | npm-debug.log 14 | yarn-error.log 15 | /.idea 16 | /.vscode 17 | /sample -------------------------------------------------------------------------------- /app/Models/Category.php: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | Copyright © Laracoffee 5 | 6 |
7 |
8 | -------------------------------------------------------------------------------- /public/js/edit_order_proof.js: -------------------------------------------------------------------------------- 1 | import { previewImage } from "./image_preview.js"; 2 | 3 | $("#image_proof_edit").on("change", function () { 4 | previewImage({ 5 | image: "image_proof_edit", 6 | image_preview: "image_preview_proof_edit", 7 | image_preview_alt: "image proof preview", 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /public/js/transaction.js: -------------------------------------------------------------------------------- 1 | $(".button_edit_transaction").click(function () { 2 | var id = $(this).attr("data-transactionId"); 3 | 4 | if ($(this).attr("data-isOutcome") == "0") { 5 | Swal.fire("Oops, you can not edit income data"); 6 | } else { 7 | window.location = "/transaction/edit_outcome/" + id; 8 | } 9 | }); 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "vite", 5 | "build": "vite build" 6 | }, 7 | "devDependencies": { 8 | "axios": "^0.27", 9 | "laravel-vite-plugin": "^0.5.0", 10 | "lodash": "^4.17.19", 11 | "postcss": "^8.1.14", 12 | "vite": "^3.0.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /storage/app/public/icons/close-icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/Unit/ExampleTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /public/js/datatables-simple.js: -------------------------------------------------------------------------------- 1 | window.addEventListener('DOMContentLoaded', event => { 2 | // Simple-DataTables 3 | // https://github.com/fiduswriter/Simple-DataTables/wiki 4 | 5 | const datatablesSimple = document.getElementById('datatablesSimple'); 6 | if (datatablesSimple) { 7 | new simpleDatatables.DataTable(datatablesSimple); 8 | } 9 | }); 10 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | 4 | export default defineConfig({ 5 | plugins: [ 6 | laravel({ 7 | input: [ 8 | 'resources/css/app.css', 9 | 'resources/js/app.js', 10 | ], 11 | refresh: true, 12 | }), 13 | ], 14 | }); 15 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Models/Bank.php: -------------------------------------------------------------------------------- 1 | hasMany(Order::class); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Models/Note.php: -------------------------------------------------------------------------------- 1 | hasMany(Order::class); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Models/Payment.php: -------------------------------------------------------------------------------- 1 | hasMany(Order::class); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Models/Status.php: -------------------------------------------------------------------------------- 1 | hasMany(Order::class); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /public/js/transaction_table.js: -------------------------------------------------------------------------------- 1 | window.addEventListener("DOMContentLoaded", (event) => { 2 | $("#transaction_table").dataTable({ 3 | columnDefs: [ 4 | { orderable: false, targets: 6 }, 5 | { className: "dt-center", targets: "_all" }, 6 | ], 7 | lengthMenu: [ 8 | [5, 10, 25, 50, 100, -1], 9 | [5, 10, 25, 50, 100, "All"], 10 | ], 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /resources/views/partials/breadcumb.blade.php: -------------------------------------------------------------------------------- 1 | 8 | 9 |
-------------------------------------------------------------------------------- /app/Models/Transaction.php: -------------------------------------------------------------------------------- 1 | belongsTo(Category::class); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Http/Middleware/PreventRequestsDuringMaintenance.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | public function hosts() 15 | { 16 | return [ 17 | $this->allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /public/js/customers_table.js: -------------------------------------------------------------------------------- 1 | window.addEventListener("DOMContentLoaded", (event) => { 2 | $("#datatablesSimple").dataTable({ 3 | oSearch: { sSearch: $("#username").val() }, 4 | columnDefs: [ 5 | // { orderable: false, targets: 8 }, 6 | { className: "dt-center", targets: "_all" }, 7 | ], 8 | lengthMenu: [ 9 | [5, 10, 25, 50, 100, -1], 10 | [5, 10, 25, 50, 100, "All"], 11 | ], 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 'current_password', 16 | 'password', 17 | 'password_confirmation', 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | hasMany(User::class); 19 | } 20 | 21 | protected $guarded = ['id']; 22 | } 23 | -------------------------------------------------------------------------------- /app/Models/Product.php: -------------------------------------------------------------------------------- 1 | hasMany(Order::class); 18 | } 19 | 20 | public function review() 21 | { 22 | return $this->hasMany(Review::class); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Models/Review.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class); 18 | } 19 | 20 | public function product() 21 | { 22 | return $this->belongsTo(Product::class); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /public/js/image_preview.js: -------------------------------------------------------------------------------- 1 | export function previewImage({ 2 | image = "image", 3 | image_preview = "image-preview", 4 | image_preview_alt = "image preview", 5 | }) { 6 | const img = document.getElementById(image); 7 | const imgPreview = document.getElementById(image_preview); 8 | 9 | const oFReader = new FileReader(); 10 | oFReader.readAsDataURL(img.files[0]); 11 | 12 | oFReader.onload = function (oFREvent) { 13 | imgPreview.src = oFREvent.target.result; 14 | imgPreview.alt = image_preview_alt; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /database/seeders/RoleSeeder.php: -------------------------------------------------------------------------------- 1 | "Admin" 20 | ]); 21 | 22 | Role::create([ 23 | "role_name" => "Customer" 24 | ]); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /database/seeders/PaymentSeeder.php: -------------------------------------------------------------------------------- 1 | "Transfer Bank" 20 | ]); 21 | 22 | Payment::create([ 23 | "payment_method" => "COD" 24 | ]); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 18 | return $request->user(); 19 | }); 20 | -------------------------------------------------------------------------------- /resources/views/home/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('/layouts/main') 2 | 3 | @push('css-dependencies') 4 | 5 | @endpush 6 | 7 | @can('is_admin') 8 | @push('scripts-dependencies') 9 | 10 | 11 | @endpush 12 | @endcan 13 | 14 | @section('content') 15 | 16 |
17 | @if(session()->has('message')) 18 | {!! session("message") !!} 19 | @endif 20 |
21 | 22 | @can('is_admin') 23 | @include('/partials/home/home_admin') 24 | @else 25 | @include('/partials/home/home_customers') 26 | @endcan 27 | @endsection -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /app/Policies/ProductPolicy.php: -------------------------------------------------------------------------------- 1 | role_id == Role::ADMIN_ID; 26 | } 27 | 28 | 29 | public function edit_product(User $user) 30 | { 31 | return $user->role_id == Role::ADMIN_ID; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /app/Policies/PointPolicy.php: -------------------------------------------------------------------------------- 1 | role_id == Role::CUSTOMER_ID; 25 | } 26 | 27 | public function convert_point(User $user) 28 | { 29 | 30 | return $user->point >= 50 && $user->role_id == Role::CUSTOMER_ID; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Middleware/AlreadyLogin.php: -------------------------------------------------------------------------------- 1 | check()) { 20 | return redirect("home"); 21 | } 22 | return $next($request); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Policies/ReviewPolicy.php: -------------------------------------------------------------------------------- 1 | user_id == $user->id; 26 | } 27 | 28 | public function delete_review(User $user, Review $review) 29 | { 30 | return $review->user_id == $user->id; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Controllers/HomeController.php: -------------------------------------------------------------------------------- 1 | authorize("is_admin"); 22 | 23 | $title = "Customers"; 24 | $customers = User::with("role")->get(); 25 | 26 | return view("home/customers", compact("title", "customers")); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | $message = "Please login first!"; 19 | 20 | myFlasherBuilder(message: $message, failed: true); 21 | return route('auth', ["url" => "auth/login"]); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'password' => 'The provided password is incorrect.', 18 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 19 | 20 | ]; 21 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | |string|null 14 | */ 15 | protected $proxies; 16 | 17 | /** 18 | * The headers that should be used to detect proxies. 19 | * 20 | * @var int 21 | */ 22 | protected $headers = 23 | Request::HEADER_X_FORWARDED_FOR | 24 | Request::HEADER_X_FORWARDED_HOST | 25 | Request::HEADER_X_FORWARDED_PORT | 26 | Request::HEADER_X_FORWARDED_PROTO | 27 | Request::HEADER_X_FORWARDED_AWS_ELB; 28 | } 29 | -------------------------------------------------------------------------------- /database/migrations/2022_08_01_022935_create_roles_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('role_name'); 19 | $table->timestamps(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('roles'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2022_08_05_142213_create_notes_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string("order_notes"); 19 | $table->timestamps(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('notes'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /app/helpers.php: -------------------------------------------------------------------------------- 1 | 16 | 17 |
' . $message . '
18 | 19 | '); 20 | } 21 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | role_id === Role::ADMIN_ID; 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /database/migrations/2022_08_05_142158_create_payments_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string("payment_method"); 19 | $table->timestamps(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('payments'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2022_08_12_090054_create_categories_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string("category_name"); 19 | $table->timestamps(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('categories'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 19 | } 20 | 21 | /** 22 | * Register the commands for the application. 23 | * 24 | * @return void 25 | */ 26 | protected function commands() 27 | { 28 | $this->load(__DIR__.'/Commands'); 29 | 30 | require base_path('routes/console.php'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/seeders/CategorySeeder.php: -------------------------------------------------------------------------------- 1 | "Product Sale", 20 | ]); 21 | 22 | Category::create([ 23 | "category_name" => "Production Cost", 24 | ]); 25 | 26 | Category::create([ 27 | "category_name" => "Marketing Cost", 28 | ]); 29 | 30 | Category::create([ 31 | "category_name" => "Server Maintanance", 32 | ]); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /public/css/point.css: -------------------------------------------------------------------------------- 1 | #wrapper { 2 | display: flex; 3 | } 4 | #wrapper #content-wrapper { 5 | background-color: #fff; 6 | width: 100%; 7 | height: 88vh; 8 | overflow-x: hidden; 9 | } 10 | #wrapper #content-wrapper #content { 11 | flex: 1 0 auto; 12 | } 13 | .point { 14 | color: #5a5c69; 15 | font-size: 7rem; 16 | position: relative; 17 | line-height: 1; 18 | width: 12.5rem; 19 | } 20 | .lead { 21 | font-size: 1.25rem; 22 | font-weight: 300; 23 | } 24 | 25 | #loading { 26 | display: flex; 27 | position: fixed; 28 | z-index: 100; 29 | width: 100%; 30 | height: 100%; 31 | background-color: rgba(192, 192, 192, 0.5); 32 | background-image: url("https://i.stack.imgur.com/MnyxU.gif"); 33 | background-repeat: no-repeat; 34 | background-position: center; 35 | } 36 | -------------------------------------------------------------------------------- /lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Your password has been reset!', 17 | 'sent' => 'We have emailed your password reset link!', 18 | 'throttled' => 'Please wait before retrying.', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that email address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /database/migrations/2022_08_05_142234_create_statuses_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string("order_status"); 19 | $table->string("style"); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::dropIfExists('statuses'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /database/migrations/2022_08_05_142133_create_banks_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string("bank_name"); 19 | $table->string("account_number"); 20 | $table->string("logo"); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('banks'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /resources/views/landing/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('/layouts/auth') 2 | 3 | @push('css-dependencies') 4 | 5 | @endpush 6 | 7 | @push('scripts-dependencies') 8 | 9 | @endpush 10 | 11 | @section("content") 12 |
13 |
14 |
15 |
16 |

Laracoffee

17 |

18 | New way to enjoy quality coffee 19 |

20 | Get Started 21 |
22 |
23 |
24 |
25 | @endsection -------------------------------------------------------------------------------- /resources/views/partials/order/blank_data.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |

?

6 |

No Data

7 | @if (!isset($is_filtered)) 8 |

No orders right now!

9 | @else 10 |

No orders with status {{ $is_filtered }}

11 | @endif 12 | 13 | @if (auth()->user()->role_id == 2) 14 | 15 | 16 | Buy some good product now 17 | 18 | @else 19 | 20 | 21 | Wanna check order history? 22 | 23 | @endif 24 |
25 |
26 |
27 |
-------------------------------------------------------------------------------- /app/Models/Order.php: -------------------------------------------------------------------------------- 1 | belongsTo(Bank::class); 17 | } 18 | 19 | public function note() 20 | { 21 | return $this->belongsTo(Note::class); 22 | } 23 | 24 | public function payment() 25 | { 26 | return $this->belongsTo(Payment::class); 27 | } 28 | 29 | public function product() 30 | { 31 | return $this->belongsTo(Product::class); 32 | } 33 | 34 | public function status() 35 | { 36 | return $this->belongsTo(Status::class); 37 | } 38 | 39 | public function user() 40 | { 41 | return $this->belongsTo(User::class); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | create(); 19 | 20 | // \App\Models\User::factory()->create([ 21 | // 'name' => 'Test User', 22 | // 'email' => 'test@example.com', 23 | // ]); 24 | 25 | $this->call([ 26 | UserSeeder::class, 27 | BankSeeder::class, 28 | RoleSeeder::class, 29 | ProductSeeder::class, 30 | NoteSeeder::class, 31 | PaymentSeeder::class, 32 | StatusSeeder::class, 33 | CategorySeeder::class 34 | ]); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/migrations/2022_08_09_132544_create_transactions_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string("category_id"); 19 | $table->string("description"); 20 | $table->integer("income")->nullable(); 21 | $table->integer("outcome")->nullable(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('transactions'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /database/migrations/2022_08_11_132444_create_reviews_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->integer("user_id"); 19 | $table->integer("product_id"); 20 | $table->integer("rating"); 21 | $table->string("review"); 22 | $table->integer("is_edit")->default(0); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('reviews'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /config/cors.php: -------------------------------------------------------------------------------- 1 | ['api/*', 'sanctum/csrf-cookie'], 19 | 20 | 'allowed_methods' => ['*'], 21 | 22 | 'allowed_origins' => ['*'], 23 | 24 | 'allowed_origins_patterns' => [], 25 | 26 | 'allowed_headers' => ['*'], 27 | 28 | 'exposed_headers' => [], 29 | 30 | 'max_age' => 0, 31 | 32 | 'supports_credentials' => false, 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 26 | return redirect(RouteServiceProvider::HOME); 27 | } 28 | } 29 | 30 | return $next($request); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Controllers/PointController.php: -------------------------------------------------------------------------------- 1 | user(); 20 | if ($user->point >= 50) { 21 | $user->coupon = $user->coupon + 1; 22 | $user->point = $user->point - 50; 23 | $user->save(); 24 | 25 | $message = "Point converted successfully"; 26 | 27 | myFlasherBuilder(message: $message, success: true); 28 | return back(); 29 | } else { 30 | $message = "Action failed, point is not enough"; 31 | 32 | myFlasherBuilder(message: $message, failed: true); 33 | return back(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /resources/views/partials/order/filter.blade.php: -------------------------------------------------------------------------------- 1 |
2 |

3 | 4 |

5 | @if ($title == "Order Data") 6 |
7 |
8 | 10 | 27 |
28 |
29 | @endif 30 |
-------------------------------------------------------------------------------- /database/seeders/StatusSeeder.php: -------------------------------------------------------------------------------- 1 | "approve", 20 | "style" => "success", 21 | ]); 22 | 23 | Status::create([ 24 | "order_status" => "pending", 25 | "style" => "warning", 26 | ]); 27 | 28 | Status::create([ 29 | "order_status" => "rejected", 30 | "style" => "danger", 31 | ]); 32 | 33 | Status::create([ 34 | "order_status" => "done", 35 | "style" => "info", 36 | ]); 37 | 38 | Status::create([ 39 | "order_status" => "canceled", 40 | "style" => "secondary", 41 | ]); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /resources/views/order/order_data.blade.php: -------------------------------------------------------------------------------- 1 | @extends('/layouts/main') 2 | 3 | @push('css-dependencies') 4 | 5 | @endpush 6 | 7 | @push('scripts-dependencies') 8 | 9 | @endpush 10 | 11 | @push('modals-dependencies') 12 | @include('/partials/order/order_detail_modal') 13 | @include('/partials/order/reject_order_modal') 14 | @include('/partials/order/transaction_proof_upload_modal') 15 | @endpush 16 | 17 | @section('content') 18 |
19 | 20 | 21 | @if(session()->has('message')) 22 | {!! session("message") !!} 23 | @endif 24 | 25 |
26 | 27 | @include('/partials/order/filter') 28 | 29 |
30 | @if (count($orders) > 0) 31 | 32 | @include('/partials/order/order_lists') 33 | 34 | @else 35 | 36 | @include('/partials/order/blank_data') 37 | 38 | @endif 39 | 40 |
41 |
42 |
43 | @endsection -------------------------------------------------------------------------------- /database/migrations/2022_08_02_142955_create_products_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('product_name', 25)->unique(); 19 | $table->text('orientation'); 20 | $table->text('description'); 21 | $table->integer('price'); 22 | $table->integer('stock'); 23 | $table->integer('discount'); 24 | $table->string('image'); 25 | $table->timestamps(); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::dropIfExists('products'); 37 | } 38 | }; 39 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | 'scheme' => 'https', 22 | ], 23 | 24 | 'postmark' => [ 25 | 'token' => env('POSTMARK_TOKEN'), 26 | ], 27 | 28 | 'ses' => [ 29 | 'key' => env('AWS_ACCESS_KEY_ID'), 30 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 31 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 32 | ], 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | > 16 | */ 17 | protected $listen = [ 18 | Registered::class => [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | // 31 | } 32 | 33 | /** 34 | * Determine if events and listeners should be automatically discovered. 35 | * 36 | * @return bool 37 | */ 38 | public function shouldDiscoverEvents() 39 | { 40 | return false; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Najib Fikri 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /database/seeders/BankSeeder.php: -------------------------------------------------------------------------------- 1 | "Mandiri", 20 | "account_number" => "092 7840 1923 7422", 21 | "logo" => "bank-mandiri.svg" 22 | ]); 23 | 24 | Bank::create([ 25 | "bank_name" => "BRI", 26 | "account_number" => "082 9192 9183 3041", 27 | "logo" => "bank-bri.svg" 28 | ]); 29 | 30 | Bank::create([ 31 | "bank_name" => "BCA", 32 | "account_number" => "019 8272 8274 1234", 33 | "logo" => "bank-bca.svg" 34 | ]); 35 | 36 | Bank::create([ 37 | "bank_name" => "BNI", 38 | "account_number" => "076 8291 6371 6279", 39 | "logo" => "bank-bni.svg" 40 | ]); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | protected $policies = [ 19 | Product::class => ProductPolicy::class, 20 | Order::class => OrderPolicy::class, 21 | Review::class => ReviewPolicy::class, 22 | Order::class => OrderPolicy::class, 23 | User::class => PointPolicy::class, 24 | // 'App\Models\Model' => 'App\Policies\ModelPolicy', 25 | ]; 26 | 27 | /** 28 | * Register any authentication / authorization services. 29 | * 30 | * @return void 31 | */ 32 | public function boot() 33 | { 34 | $this->registerPolicies(); 35 | // 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /public/css/profile.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin-top: 20px; 3 | color: #1a202c; 4 | text-align: left; 5 | background-color: #e2e8f0; 6 | } 7 | .main-body { 8 | padding: 15px; 9 | } 10 | .card { 11 | box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); 12 | } 13 | 14 | .card { 15 | position: relative; 16 | display: flex; 17 | flex-direction: column; 18 | min-width: 0; 19 | word-wrap: break-word; 20 | background-color: #fff; 21 | background-clip: border-box; 22 | border: 0 solid rgba(0, 0, 0, 0.125); 23 | border-radius: 0.25rem; 24 | } 25 | 26 | .card-body { 27 | flex: 1 1 auto; 28 | min-height: 1px; 29 | padding: 1rem; 30 | } 31 | 32 | .gutters-sm { 33 | margin-right: -8px; 34 | margin-left: -8px; 35 | } 36 | 37 | .gutters-sm > .col, 38 | .gutters-sm > [class*="col-"] { 39 | padding-right: 8px; 40 | padding-left: 8px; 41 | } 42 | .mb-3, 43 | .my-3 { 44 | margin-bottom: 1rem !important; 45 | } 46 | 47 | .bg-gray-300 { 48 | background-color: #e2e8f0; 49 | } 50 | .h-100 { 51 | height: 100% !important; 52 | } 53 | .shadow-none { 54 | box-shadow: none !important; 55 | } 56 | -------------------------------------------------------------------------------- /resources/views/partials/order/reject_order_modal.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /database/seeders/NoteSeeder.php: -------------------------------------------------------------------------------- 1 | "waiting for COD meeting" 20 | ]); 21 | 22 | Note::create([ 23 | "order_notes" => "[no proof of transfer] is waiting for the proof of transaction to be sent" 24 | ]); 25 | 26 | Note::create([ 27 | "order_notes" => "proof of transfer successfully sent, waiting for approval from admin" 28 | ]); 29 | 30 | Note::create([ 31 | "order_notes" => "proof of transfer approved, waiting for product delivery" 32 | ]); 33 | 34 | Note::create([ 35 | "order_notes" => "transaction success" 36 | ]); 37 | 38 | Note::create([ 39 | "order_notes" => "the order is canceled directly by the user" 40 | ]); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => env( 32 | 'VIEW_COMPILED_PATH', 33 | realpath(storage_path('framework/views')) 34 | ), 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | , \Psr\Log\LogLevel::*> 14 | */ 15 | protected $levels = [ 16 | // 17 | ]; 18 | 19 | /** 20 | * A list of the exception types that are not reported. 21 | * 22 | * @var array> 23 | */ 24 | protected $dontReport = [ 25 | // 26 | ]; 27 | 28 | /** 29 | * A list of the inputs that are never flashed to the session on validation exceptions. 30 | * 31 | * @var array 32 | */ 33 | protected $dontFlash = [ 34 | 'current_password', 35 | 'password', 36 | 'password_confirmation', 37 | ]; 38 | 39 | /** 40 | * Register the exception handling callbacks for the application. 41 | * 42 | * @return void 43 | */ 44 | public function register() 45 | { 46 | $this->reportable(function (Throwable $e) { 47 | // 48 | }); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /database/migrations/2022_07_31_034300_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('fullname'); 19 | $table->string('username')->unique(); 20 | $table->string('email')->unique(); 21 | $table->string('password'); 22 | $table->integer('role_id'); 23 | $table->string('image'); 24 | $table->string('phone'); 25 | $table->char('gender'); 26 | $table->string('address'); 27 | $table->integer('coupon'); 28 | $table->integer('point'); 29 | $table->rememberToken(); 30 | $table->timestamps(); 31 | }); 32 | } 33 | 34 | /** 35 | * Reverse the migrations. 36 | * 37 | * @return void 38 | */ 39 | public function down() 40 | { 41 | Schema::dropIfExists('users'); 42 | } 43 | }; 44 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | ./tests/Unit 10 | 11 | 12 | ./tests/Feature 13 | 14 | 15 | 16 | 17 | ./app 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | import _ from 'lodash'; 2 | window._ = _; 3 | 4 | /** 5 | * We'll load the axios HTTP library which allows us to easily issue requests 6 | * to our Laravel back-end. This library automatically handles sending the 7 | * CSRF token as a header based on the value of the "XSRF" token cookie. 8 | */ 9 | 10 | import axios from 'axios'; 11 | window.axios = axios; 12 | 13 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 14 | 15 | /** 16 | * Echo exposes an expressive API for subscribing to channels and listening 17 | * for events that are broadcast by Laravel. Echo and event broadcasting 18 | * allows your team to easily build robust real-time web applications. 19 | */ 20 | 21 | // import Echo from 'laravel-echo'; 22 | 23 | // import Pusher from 'pusher-js'; 24 | // window.Pusher = Pusher; 25 | 26 | // window.Echo = new Echo({ 27 | // broadcaster: 'pusher', 28 | // key: import.meta.env.VITE_PUSHER_APP_KEY, 29 | // wsHost: import.meta.env.VITE_PUSHER_HOST ?? `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, 30 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, 31 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, 32 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', 33 | // enabledTransports: ['ws', 'wss'], 34 | // }); 35 | -------------------------------------------------------------------------------- /database/migrations/2022_08_05_141036_create_orders_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->integer("product_id"); 19 | $table->integer("user_id"); 20 | $table->integer("quantity"); 21 | $table->string("address"); 22 | $table->string("shipping_address"); 23 | $table->integer("total_price"); 24 | $table->integer("payment_id"); 25 | $table->integer("bank_id")->nullable(); 26 | $table->integer("note_id"); 27 | $table->integer("status_id"); 28 | $table->string("transaction_doc")->nullable(); 29 | $table->integer("is_done"); 30 | $table->string("refusal_reason")->nullable(); 31 | $table->integer("coupon_used"); 32 | $table->timestamps(); 33 | }); 34 | } 35 | 36 | /** 37 | * Reverse the migrations. 38 | * 39 | * @return void 40 | */ 41 | public function down() 42 | { 43 | Schema::dropIfExists('orders'); 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /resources/views/layouts/auth.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{ $title }} Page 9 | 12 | 14 | 16 | @include('/partials/main_css') 17 | @stack('css-dependencies') 18 | 19 | 20 | 21 | @yield("content") 22 | 23 | 25 | 27 | 28 | 29 | @stack('scripts-dependencies') 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | 20 | */ 21 | // protected $fillable = [ 22 | // 'name', 23 | // 'email', 24 | // 'password', 25 | // ]; 26 | 27 | protected $guarded = ['id']; 28 | 29 | /** 30 | * The attributes that should be hidden for serialization. 31 | * 32 | * @var array 33 | */ 34 | protected $hidden = [ 35 | 'password', 36 | 'remember_token', 37 | ]; 38 | 39 | /** 40 | * The attributes that should be cast. 41 | * 42 | * @var array 43 | */ 44 | protected $casts = [ 45 | 'email_verified_at' => 'datetime', 46 | ]; 47 | 48 | public function role() 49 | { 50 | return $this->belongsTo(Role::class); 51 | } 52 | 53 | public function order() 54 | { 55 | return $this->hasMany(Order::class); 56 | } 57 | 58 | public function review() 59 | { 60 | return $this->hasMany(Review::class); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class UserFactory extends Factory 13 | { 14 | /** 15 | * Define the model's default state. 16 | * 17 | * @return array 18 | */ 19 | public function definition() 20 | { 21 | $str_gender = "MF"; 22 | return [ 23 | 'role_id' => 2, 24 | 'fullname' => fake()->name(), 25 | 'username' => fake()->firstName(), 26 | 'email' => fake()->safeEmail(), 27 | 'password' => Hash::make("1234"), // password, 28 | 'image' => env("IMAGE_PROFILE"), 29 | 'phone' => fake()->phoneNumber(), 30 | 'gender' => $str_gender[rand(0, 1)], 31 | 'address' => fake()->address(), 32 | 'role_id' => 2, 33 | 'coupon' => 0, 34 | 'point' => 0, 35 | 'remember_token' => Str::random(30), 36 | ]; 37 | } 38 | 39 | /** 40 | * Indicate that the model's email address should be unverified. 41 | * 42 | * @return static 43 | */ 44 | public function unverified() 45 | { 46 | return $this->state(function (array $attributes) { 47 | return [ 48 | 'email_verified_at' => null, 49 | ]; 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | configureRateLimiting(); 30 | 31 | $this->routes(function () { 32 | Route::middleware('api') 33 | ->prefix('api') 34 | ->group(base_path('routes/api.php')); 35 | 36 | Route::middleware('web') 37 | ->group(base_path('routes/web.php')); 38 | }); 39 | } 40 | 41 | /** 42 | * Configure the rate limiters for the application. 43 | * 44 | * @return void 45 | */ 46 | protected function configureRateLimiting() 47 | { 48 | RateLimiter::for('api', function (Request $request) { 49 | return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | LOG_DEPRECATIONS_CHANNEL=null 9 | LOG_LEVEL=debug 10 | 11 | DB_CONNECTION=mysql 12 | DB_HOST=127.0.0.1 13 | DB_PORT=3306 14 | DB_DATABASE=laracoffee 15 | DB_USERNAME=root 16 | DB_PASSWORD= 17 | 18 | BROADCAST_DRIVER=log 19 | CACHE_DRIVER=file 20 | FILESYSTEM_DISK=local 21 | QUEUE_CONNECTION=sync 22 | SESSION_DRIVER=file 23 | SESSION_LIFETIME=120 24 | 25 | MEMCACHED_HOST=127.0.0.1 26 | 27 | REDIS_HOST=127.0.0.1 28 | REDIS_PASSWORD=null 29 | REDIS_PORT=6379 30 | 31 | MAIL_MAILER=smtp 32 | MAIL_HOST=mailhog 33 | MAIL_PORT=1025 34 | MAIL_USERNAME=null 35 | MAIL_PASSWORD=null 36 | MAIL_ENCRYPTION=null 37 | MAIL_FROM_ADDRESS="hello@example.com" 38 | MAIL_FROM_NAME="${APP_NAME}" 39 | 40 | AWS_ACCESS_KEY_ID= 41 | AWS_SECRET_ACCESS_KEY= 42 | AWS_DEFAULT_REGION=us-east-1 43 | AWS_BUCKET= 44 | AWS_USE_PATH_STYLE_ENDPOINT=false 45 | 46 | PUSHER_APP_ID= 47 | PUSHER_APP_KEY= 48 | PUSHER_APP_SECRET= 49 | PUSHER_HOST= 50 | PUSHER_PORT=443 51 | PUSHER_SCHEME=https 52 | PUSHER_APP_CLUSTER=mt1 53 | 54 | VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 55 | VITE_PUSHER_HOST="${PUSHER_HOST}" 56 | VITE_PUSHER_PORT="${PUSHER_PORT}" 57 | VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" 58 | VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 59 | 60 | 61 | 62 | IMAGE_PROFILE=profile/cV8nuMT7VBfYYtANwUxegJ366XDbw0nXdxLEvehk.jpg 63 | IMAGE_PRODUCT=product/sPISped9AR4XyNKlkSpiUyo7OkcJj8mSBmPuF6Ky.png 64 | IMAGE_PROOF=proof/fmg7fWMmb7mNvnHHA70IlRXxRF4wsD9J6dQAUZkV.png 65 | 66 | API_RAJAONGKIR=YOUR_API_KEY 67 | -------------------------------------------------------------------------------- /resources/views/point/user_point.blade.php: -------------------------------------------------------------------------------- 1 | @extends('/layouts/main') 2 | 3 | @push('css-dependencies') 4 | 5 | @endpush 6 | 7 | @push('scripts-dependencies') 8 | 9 | @endpush 10 | 11 | @section('content') 12 | 13 |
14 | 15 | @if(session()->has('message')) 16 | {!! session("message") !!} 17 | @endif 18 | 19 |
20 |
21 |
22 |
23 |
24 |
25 | {{ auth()->user()->point }} 26 | /50
27 |

Your Point

28 |

Get points every time you buy our products to get free products 29 |

30 |
31 | @csrf 32 | 35 |
36 |
current coupon : 37 | {{auth()->user()->coupon}} 38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | @endsection -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 65536, 48 | 'threads' => 1, 49 | 'time' => 4, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /resources/views/partials/order/transaction_proof_upload_modal.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /resources/views/layouts/main.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{ $title }} Page 9 | 10 | 11 | 12 | 13 | @include('/partials/main_css') 14 | @stack('css-dependencies') 15 | 16 | 17 | 18 | 19 | {{-- topbar --}} 20 | @include('/partials/topbar') 21 |
22 |
23 | {{-- sidebar --}} 24 | @include('/partials/sidebar') 25 |
26 |
27 | {{-- content --}} 28 | @yield("content") 29 | {{-- footer --}} 30 | @include('/partials/footer') 31 |
32 |
33 | 34 | @stack('modals-dependencies') 35 | 36 | 38 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | @stack('scripts-dependencies') 47 | 48 | 49 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /app/Policies/OrderPolicy.php: -------------------------------------------------------------------------------- 1 | role_id == Role::CUSTOMER_ID; 26 | } 27 | 28 | 29 | public function cancel_order(User $user, Order $order) 30 | { 31 | return $user->role_id == Role::CUSTOMER_ID && $order->user_id == $user->id; 32 | } 33 | 34 | 35 | public function edit_order(User $user, Order $order) 36 | { 37 | return $user->role_id == Role::CUSTOMER_ID && $order->user_id == $user->id; 38 | } 39 | 40 | 41 | public function reject_order(User $user) 42 | { 43 | return $user->role_id == Role::ADMIN_ID; 44 | } 45 | 46 | 47 | public function end_order(User $user) 48 | { 49 | return $user->role_id == Role::ADMIN_ID; 50 | } 51 | 52 | 53 | public function approve_order(User $user) 54 | { 55 | return $user->role_id == Role::ADMIN_ID; 56 | } 57 | 58 | 59 | public function my_real_order(User $user, Order $order) 60 | { 61 | return $user->role_id == Role::ADMIN_ID || ($user->role_id == Role::CUSTOMER_ID && $order->user_id == $user->id); 62 | } 63 | 64 | 65 | public function upload_proof(User $user, Order $order) 66 | { 67 | return $user->role_id == Role::CUSTOMER_ID && $order->user_id == $user->id; 68 | } 69 | 70 | 71 | public function delete_proof(User $user, Order $order) 72 | { 73 | return $user->role_id == Role::CUSTOMER_ID && $order->user_id == $user->id; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /public/js/point.js: -------------------------------------------------------------------------------- 1 | const setVisible = (elementOrSelector, visible) => 2 | ((typeof elementOrSelector === "string" 3 | ? document.querySelector(elementOrSelector) 4 | : elementOrSelector 5 | ).style.display = visible ? "block" : "none"); 6 | 7 | // convert point 8 | $("#button_convert_point").click(function (e) { 9 | e.preventDefault(); 10 | const isValid = $(this).attr("data-isCanConvert"); 11 | console.log($(this).attr("data-isCanConvert")); 12 | console.log(isValid == "true"); 13 | 14 | if (isValid == "true") { 15 | Swal.fire({ 16 | title: "Are you sure?", 17 | text: "after this process, your points will be converted as coupon", 18 | icon: "question", 19 | confirmButtonText: "Confirm", 20 | cancelButtonColor: "#d33", 21 | showCancelButton: true, 22 | confirmButtonColor: "#08a10b", 23 | timer: 5000, 24 | }).then((result) => { 25 | if (result.isConfirmed) { 26 | Swal.fire({ 27 | position: "center", 28 | icon: "success", 29 | title: "Action is in progress", 30 | showConfirmButton: false, 31 | timer: 2000, 32 | }).then((_) => { 33 | setVisible("#loading", true); 34 | $("#form_convert_point").submit(); 35 | }); 36 | } else if (result.isDismissed) { 37 | Swal.fire("Action canceled", "", "info"); 38 | } 39 | }); 40 | } else { 41 | Swal.fire({ 42 | position: "center", 43 | icon: "error", 44 | title: "Your points are not enough", 45 | text: "collect 50 points to get 1 coupon", 46 | showConfirmButton: false, 47 | timer: 2000, 48 | }); 49 | } 50 | }); 51 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class); 50 | 51 | $response = $kernel->handle( 52 | $request = Request::capture() 53 | )->send(); 54 | 55 | $kernel->terminate($request, $response); 56 | -------------------------------------------------------------------------------- /resources/views/partials/topbar.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The Laravel Framework.", 5 | "keywords": [ 6 | "framework", 7 | "laravel" 8 | ], 9 | "license": "MIT", 10 | "require": { 11 | "php": "^8.0.2", 12 | "guzzlehttp/guzzle": "^7.2", 13 | "laravel/framework": "^9.19", 14 | "laravel/sanctum": "^2.14.1", 15 | "laravel/tinker": "^2.7" 16 | }, 17 | "require-dev": { 18 | "barryvdh/laravel-debugbar": "^3.7", 19 | "fakerphp/faker": "^1.9.1", 20 | "laravel/pint": "^1.0", 21 | "laravel/sail": "^1.0.1", 22 | "mockery/mockery": "^1.4.4", 23 | "nunomaduro/collision": "^6.1", 24 | "phpunit/phpunit": "^9.5.10", 25 | "spatie/laravel-ignition": "^1.0" 26 | }, 27 | "autoload": { 28 | "psr-4": { 29 | "App\\": "app/", 30 | "Database\\Factories\\": "database/factories/", 31 | "Database\\Seeders\\": "database/seeders/" 32 | }, 33 | "files": [ 34 | "app/helpers.php" 35 | ] 36 | }, 37 | "autoload-dev": { 38 | "psr-4": { 39 | "Tests\\": "tests/" 40 | } 41 | }, 42 | "scripts": { 43 | "post-autoload-dump": [ 44 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 45 | "@php artisan package:discover --ansi" 46 | ], 47 | "post-update-cmd": [ 48 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force" 49 | ], 50 | "post-root-package-install": [ 51 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 52 | ], 53 | "post-create-project-cmd": [ 54 | "@php artisan key:generate --ansi" 55 | ] 56 | }, 57 | "extra": { 58 | "laravel": { 59 | "dont-discover": [] 60 | } 61 | }, 62 | "config": { 63 | "optimize-autoloader": true, 64 | "preferred-install": "dist", 65 | "sort-packages": true 66 | }, 67 | "minimum-stability": "dev", 68 | "prefer-stable": true 69 | } 70 | -------------------------------------------------------------------------------- /database/seeders/UserSeeder.php: -------------------------------------------------------------------------------- 1 | "Moh. Najib Fikri", 22 | "username" => "pStar7", 23 | "email" => "najibfikri13@gmail.com", 24 | "password" => Hash::make("1234"), 25 | "image" => env("IMAGE_PROFILE"), 26 | "phone" => "08123456789123", 27 | "gender" => "M", 28 | "address" => "Shell road number 10", 29 | "role_id" => 1, 30 | "coupon" => 0, 31 | "point" => 0, 32 | 'remember_token' => Str::random(30), 33 | ]); 34 | 35 | User::create([ 36 | "fullname" => "Patrick Star", 37 | "username" => "its_me", 38 | "email" => "member@gmail.com", 39 | "password" => Hash::make("1234"), 40 | "image" => env("IMAGE_PROFILE"), 41 | "phone" => "082918391823", 42 | "gender" => "M", 43 | "address" => "Shell road number 18", 44 | "role_id" => 2, 45 | "coupon" => 0, 46 | "point" => 0, 47 | 'remember_token' => Str::random(30), 48 | ]); 49 | 50 | User::create([ 51 | "fullname" => "Squidy", 52 | "username" => "goodman", 53 | "email" => "squidy@gmail.com", 54 | "password" => Hash::make("1234"), 55 | "image" => env("IMAGE_PROFILE"), 56 | "phone" => "019292823382", 57 | "gender" => "M", 58 | "address" => "Small healt", 59 | "role_id" => 2, 60 | "coupon" => 0, 61 | "point" => 0, 62 | 'remember_token' => Str::random(30), 63 | ]); 64 | 65 | User::factory(5)->create(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /resources/views/home/customers.blade.php: -------------------------------------------------------------------------------- 1 | @extends('/layouts/main') 2 | 3 | @push('css-dependencies') 4 | 5 | @endpush 6 | 7 | @push('scripts-dependencies') 8 | 9 | 10 | @endpush 11 | 12 | @section('content') 13 | 14 |
15 | 16 | @include('/partials/breadcumb') 17 | 18 | 19 | 21 | 22 |
23 |
24 | 25 | Customers 26 |
27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | @foreach ($customers as $row) 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | @endforeach 54 | 55 |
Full NameUsernameEmailRoleGenderPhoneAddressCreated At
{{ $row->fullname }}{{ $row->username }}{{ $row->email }}{{ $row->role->role_name }}{{ $row->gender == "M" ? "Male" : "Female" }}{{ $row->phone }}{{ $row->address }}{{ date('d-m-Y', strtotime($row->created_at)) }}
56 |
57 |
58 |
59 | @endsection -------------------------------------------------------------------------------- /public/js/scripts.js: -------------------------------------------------------------------------------- 1 | window.addEventListener("DOMContentLoaded", (event) => { 2 | // Toggle the side navigation 3 | const sidebarToggle = document.body.querySelector("#sidebarToggle"); 4 | if (sidebarToggle) { 5 | // Uncomment Below to persist sidebar toggle between refreshes 6 | if (localStorage.getItem("sb|sidebar-toggle") == "true") { 7 | document.body.classList.toggle("sb-sidenav-toggled"); 8 | } 9 | sidebarToggle.addEventListener("click", (event) => { 10 | event.preventDefault(); 11 | document.body.classList.toggle("sb-sidenav-toggled"); 12 | localStorage.setItem( 13 | "sb|sidebar-toggle", 14 | document.body.classList.contains("sb-sidenav-toggled") 15 | ); 16 | }); 17 | } 18 | }); 19 | 20 | // sweetalert 2 21 | $("button.auth_logout").click(function (e) { 22 | e.preventDefault(); 23 | const form = document.getElementById("form_auth_logout"); 24 | 25 | Swal.fire({ 26 | title: "Are you sure?", 27 | text: "click logout if you want to end your session", 28 | confirmButtonText: "Logout", 29 | cancelButtonColor: "#d33", 30 | showCancelButton: true, 31 | confirmButtonColor: "#08a10b", 32 | timer: 10000, 33 | }).then((result) => { 34 | if (result.isConfirmed) { 35 | let timerInterval; 36 | Swal.fire({ 37 | title: "Auto close alert!", 38 | html: "I will close in milliseconds.", 39 | timer: 1000, 40 | timerProgressBar: true, 41 | didOpen: () => { 42 | Swal.showLoading(); 43 | const b = Swal.getHtmlContainer().querySelector("b"); 44 | timerInterval = setInterval(() => { 45 | b.textContent = Swal.getTimerLeft(); 46 | }, 100); 47 | }, 48 | willClose: () => { 49 | clearInterval(timerInterval); 50 | }, 51 | }).then((result) => { 52 | if (result.dismiss === Swal.DismissReason.timer) { 53 | form.submit(); 54 | } 55 | }); 56 | } else { 57 | Swal.fire("Failed, request timeout", "", "info"); 58 | } 59 | }); 60 | }); 61 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 40 | 'port' => env('PUSHER_PORT', 443), 41 | 'scheme' => env('PUSHER_SCHEME', 'https'), 42 | 'encrypted' => true, 43 | 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', 44 | ], 45 | 'client_options' => [ 46 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 47 | ], 48 | ], 49 | 50 | 'ably' => [ 51 | 'driver' => 'ably', 52 | 'key' => env('ABLY_KEY'), 53 | ], 54 | 55 | 'redis' => [ 56 | 'driver' => 'redis', 57 | 'connection' => 'default', 58 | ], 59 | 60 | 'log' => [ 61 | 'driver' => 'log', 62 | ], 63 | 64 | 'null' => [ 65 | 'driver' => 'null', 66 | ], 67 | 68 | ], 69 | 70 | ]; 71 | -------------------------------------------------------------------------------- /config/sanctum.php: -------------------------------------------------------------------------------- 1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 19 | '%s%s', 20 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', 21 | Sanctum::currentApplicationUrlWithPort() 22 | ))), 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Sanctum Guards 27 | |-------------------------------------------------------------------------- 28 | | 29 | | This array contains the authentication guards that will be checked when 30 | | Sanctum is trying to authenticate a request. If none of these guards 31 | | are able to authenticate the request, Sanctum will use the bearer 32 | | token that's present on an incoming request for authentication. 33 | | 34 | */ 35 | 36 | 'guard' => ['web'], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Expiration Minutes 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This value controls the number of minutes until an issued token will be 44 | | considered expired. If this value is null, personal access tokens do 45 | | not expire. This won't tweak the lifetime of first-party sessions. 46 | | 47 | */ 48 | 49 | 'expiration' => null, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Sanctum Middleware 54 | |-------------------------------------------------------------------------- 55 | | 56 | | When authenticating your first-party SPA with Sanctum you may need to 57 | | customize some of the middleware Sanctum uses while processing the 58 | | request. You may change the middleware listed below as required. 59 | | 60 | */ 61 | 62 | 'middleware' => [ 63 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 64 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, 65 | ], 66 | 67 | ]; 68 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DISK', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Filesystem Disks 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure as many filesystem "disks" as you wish, and you 24 | | may even configure multiple disks of the same driver. Defaults have 25 | | been set up for each driver as an example of the required values. 26 | | 27 | | Supported Drivers: "local", "ftp", "sftp", "s3" 28 | | 29 | */ 30 | 31 | 'disks' => [ 32 | 33 | 'local' => [ 34 | 'driver' => 'local', 35 | 'root' => storage_path('app'), 36 | 'throw' => false, 37 | ], 38 | 39 | 'public' => [ 40 | 'driver' => 'local', 41 | 'root' => storage_path('app/public'), 42 | 'url' => env('APP_URL').'/storage', 43 | 'visibility' => 'public', 44 | 'throw' => false, 45 | ], 46 | 47 | 's3' => [ 48 | 'driver' => 's3', 49 | 'key' => env('AWS_ACCESS_KEY_ID'), 50 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 51 | 'region' => env('AWS_DEFAULT_REGION'), 52 | 'bucket' => env('AWS_BUCKET'), 53 | 'url' => env('AWS_URL'), 54 | 'endpoint' => env('AWS_ENDPOINT'), 55 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 56 | 'throw' => false, 57 | ], 58 | 59 | ], 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Symbolic Links 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may configure the symbolic links that will be created when the 67 | | `storage:link` Artisan command is executed. The array keys should be 68 | | the locations of the links and the values should be their targets. 69 | | 70 | */ 71 | 72 | 'links' => [ 73 | public_path('storage') => storage_path('app/public'), 74 | ], 75 | 76 | ]; 77 | -------------------------------------------------------------------------------- /resources/views/partials/product/product_detail_modal.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 52 | -------------------------------------------------------------------------------- /resources/views/partials/sidebar.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/js/review.js: -------------------------------------------------------------------------------- 1 | var ratingNow; 2 | 3 | function isClickStar(ratingN) { 4 | ratingNow = ratingN; 5 | console.log(ratingNow); 6 | } 7 | 8 | const setVisible = (elementOrSelector, visible) => 9 | ((typeof elementOrSelector === "string" 10 | ? document.querySelector(elementOrSelector) 11 | : elementOrSelector 12 | ).style.display = visible ? "block" : "none"); 13 | 14 | $(".link_edit_review").click(function (e) { 15 | var id = $(this).attr("data-idReview"); 16 | 17 | setVisible("#loading", true); 18 | 19 | $.ajax({ 20 | url: "/review/data/" + id, 21 | method: "get", 22 | dataType: "json", 23 | success: function (response) { 24 | ratingNow = parseInt(response["rating"]); 25 | $("#message_edit_review").html(""); 26 | 27 | $("#form_edit_review").attr( 28 | "action", 29 | "/review/edit_review/" + response["id"] 30 | ); 31 | 32 | $("#review_edit").attr("data-oldRating", response["rating"]); 33 | $("#review_edit").attr("data-oldReview", response["review"]); 34 | 35 | $("#review_edit").val(response["review"]); 36 | $("input[type=radio][value=" + response["rating"] + "]").prop( 37 | "checked", 38 | true 39 | ); 40 | 41 | $("#EditReviewModal").modal("show"); 42 | setVisible("#loading", false); 43 | }, 44 | }); 45 | }); 46 | 47 | $("#form_edit_review").submit(function (event) { 48 | if ($("#review_edit").val() == "") { 49 | $("#message_edit_review").html("Review field can not be empty!"); 50 | 51 | event.preventDefault(); 52 | } else if ( 53 | parseInt($("#review_edit").attr("data-oldRating")) == ratingNow && 54 | $("#review_edit").attr("data-oldReview") == $("#review_edit").val() 55 | ) { 56 | console.log(ratingNow); 57 | 58 | $("#message_edit_review").html("No changes detected"); 59 | 60 | event.preventDefault(); 61 | } 62 | 63 | return; 64 | }); 65 | 66 | // delete review [customer] 67 | $("#button_delete_review").click(function (e) { 68 | e.preventDefault(); 69 | Swal.fire({ 70 | title: "Are you sure?", 71 | text: "your review will be deleted", 72 | icon: "question", 73 | confirmButtonText: "Confirm", 74 | cancelButtonColor: "#d33", 75 | showCancelButton: true, 76 | confirmButtonColor: "#08a10b", 77 | timer: 10000, 78 | }).then((result) => { 79 | if (result.isConfirmed) { 80 | $("#form_delete_review").submit(); 81 | } else if (result.isDismissed) { 82 | Swal.fire("Action canceled", "", "info"); 83 | } 84 | }); 85 | }); 86 | -------------------------------------------------------------------------------- /resources/views/partials/order/order_lists.blade.php: -------------------------------------------------------------------------------- 1 | 2 | @foreach ($orders as $row) 3 |
4 |
5 | 6 |
detail 8 |
9 |
10 |
11 |
12 |
13 |
14 | 17 |
18 | 19 | 20 | {{ $row->product->product_name }} 21 | 22 | {{ $row->payment->payment_method }} 23 |
24 | Quantity : {{ $row->quantity }}, Total price: Rp. {{ $row->total_price }}
25 | 26 | Notes: {{ (isset($row->refusal_reason)) ? $row->refusal_reason : $row->note->order_notes }} 27 |
28 | 29 | @if ($row->payment->payment_method == "Transfer Bank" && auth()->user()->role_id == 2) 30 | Action 31 | 32 |
34 |
35 |
36 | @endif 37 | 38 | @if (isset($row->product_id) && auth()->user()->role_id == 2 && $row->is_done == 1) 39 | 45 | @endif 46 |
47 | @php 48 | if (auth()->user()->role_id == 1) { 49 | $dest = "/home/customers?username=" . $row->user->username; 50 | } 51 | else { 52 | $dest = "/profile/my_profile"; 53 | } 54 | @endphp 55 | 56 | @if ($row->is_done == '1') 57 |
order ends at {{ $row->updated_at->format('d M Y') }} by @admin 59 |
60 | @else 61 |
order created at {{ $row->created_at->format('d M Y') }} by {{ "@" . $row->user->username }} 63 |
64 | @endif 65 |
66 |
67 |
68 | @endforeach -------------------------------------------------------------------------------- /app/Http/Controllers/TransactionController.php: -------------------------------------------------------------------------------- 1 | get(); 15 | 16 | return view("/transaction/index", compact("title", "transactions")); 17 | } 18 | 19 | 20 | public function addOutcomeGet() 21 | { 22 | $title = "Add Outcome"; 23 | $categories = Category::where("id", "!=", 1)->get(); 24 | 25 | return view("/transaction/add_outcome", compact("title", "categories")); 26 | } 27 | 28 | 29 | public function addOutcomePost(Request $request) 30 | { 31 | $validatedData = $request->validate( 32 | [ 33 | "category_id" => "required|numeric|gt:0", 34 | "outcome" => "required|numeric|gt:0", 35 | "description" => "required" 36 | ], 37 | [ 38 | "category_id.gt" => "Please select the category" 39 | ] 40 | ); 41 | 42 | Transaction::create($validatedData); 43 | 44 | $message = "Transaction created successfully!"; 45 | 46 | myFlasherBuilder(message: $message, success: true); 47 | 48 | return redirect("/transaction"); 49 | } 50 | 51 | 52 | public function editOutcomeGet(Transaction $transaction) 53 | { 54 | $title = "Edit Outcome"; 55 | $transaction->load("category"); 56 | $categories = Category::where("id", "!=", 1)->get(); 57 | 58 | return view("/transaction/edit_outcome", compact("title", "transaction", "categories")); 59 | } 60 | 61 | public function editOutcomePost(Request $request, Transaction $transaction) 62 | { 63 | $validatedData = $request->validate( 64 | [ 65 | "category_id" => "required|numeric|gt:0", 66 | "outcome" => "required|numeric|gt:0", 67 | "description" => "required" 68 | ], 69 | [ 70 | "category_id.gt" => "Please select the category" 71 | ] 72 | ); 73 | 74 | $transaction->fill($validatedData); 75 | 76 | if ($transaction->isDirty()) { 77 | $transaction->save(); 78 | 79 | 80 | $message = "Transaction updated successfully!"; 81 | 82 | myFlasherBuilder(message: $message, success: true); 83 | 84 | return redirect("/transaction"); 85 | } else { 86 | $message = "Action failed, no changes detected!"; 87 | 88 | myFlasherBuilder(message: $message, failed: true); 89 | 90 | return back(); 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | protected $middleware = [ 17 | // \App\Http\Middleware\TrustHosts::class, 18 | \App\Http\Middleware\TrustProxies::class, 19 | \Illuminate\Http\Middleware\HandleCors::class, 20 | \App\Http\Middleware\PreventRequestsDuringMaintenance::class, 21 | \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, 22 | \App\Http\Middleware\TrimStrings::class, 23 | \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, 24 | ]; 25 | 26 | /** 27 | * The application's route middleware groups. 28 | * 29 | * @var array> 30 | */ 31 | protected $middlewareGroups = [ 32 | 'web' => [ 33 | \App\Http\Middleware\EncryptCookies::class, 34 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 35 | \Illuminate\Session\Middleware\StartSession::class, 36 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 37 | \App\Http\Middleware\VerifyCsrfToken::class, 38 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 39 | ], 40 | 41 | 'api' => [ 42 | // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 43 | 'throttle:api', 44 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 45 | ], 46 | ]; 47 | 48 | /** 49 | * The application's route middleware. 50 | * 51 | * These middleware may be assigned to groups or used individually. 52 | * 53 | * @var array 54 | */ 55 | protected $routeMiddleware = [ 56 | 'auth' => \App\Http\Middleware\Authenticate::class, 57 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 58 | 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 59 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 60 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 61 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 62 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 63 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 64 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 65 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 66 | 'alreadyLogin' => \App\Http\Middleware\AlreadyLogin::class, 67 | ]; 68 | } 69 | -------------------------------------------------------------------------------- /storage/app/public/icons/bank-mandiri.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/views/partials/review/edit_review_modal.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/views/transaction/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('/layouts/main') 2 | 3 | @push('css-dependencies') 4 | 5 | @endpush 6 | 7 | 8 | @push('scripts-dependencies') 9 | 10 | 11 | 12 | @endpush 13 | 14 | 15 | @section('content') 16 |
17 |
18 | 19 | 20 | @if(session()->has('message')) 21 | {!! session("message") !!} 22 | @endif 23 | 24 | @include('/partials/breadcumb') 25 | 26 |
27 |
28 | 29 | Transaction 30 |
31 |
32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 48 | 49 | @php 50 | $inc = 0 51 | @endphp 52 | @foreach ($transactions as $transaction) 53 | 54 | 57 | 60 | 63 | 66 | 69 | 72 | 75 | 80 | 81 | @endforeach 82 | 83 |
Index TitleDescriptionIncomeOutcomeCreated AtUpdated AtInterface
55 | {{ ++$inc }} 56 | 58 | {{ $transaction->category->category_name }} 59 | 61 | {{ $transaction->description }} 62 | 64 | {{$transaction->income ? $transaction->income : "----"}} 65 | 67 | {{$transaction->outcome ? $transaction->outcome : "----"}} 68 | 70 | {{$transaction->created_at->format('d-m-Y')}} 71 | 73 | {{$transaction->updated_at->format('d-m-Y')}} 74 | 76 | 79 |
84 |
85 |
86 |
87 |
88 | @endsection -------------------------------------------------------------------------------- /app/Http/Controllers/AuthController.php: -------------------------------------------------------------------------------- 1 | validate([ 22 | 'email' => 'required|email:dns', 23 | 'password' => 'required' 24 | ]); 25 | 26 | if (Auth::attempt($credentials)) { 27 | $request->session()->regenerate(); 28 | $message = "Login success"; 29 | 30 | myFlasherBuilder(message: $message, success: true); 31 | return redirect('/home'); 32 | } 33 | 34 | $message = "Wrong credential"; 35 | 36 | myFlasherBuilder(message: $message, failed: true); 37 | return back(); 38 | } 39 | 40 | public function registrationGet() 41 | { 42 | $title = "Registration"; 43 | 44 | return view('/auth/register', compact("title")); 45 | } 46 | 47 | public function registrationPost(Request $request) 48 | { 49 | $validatedData = $request->validate([ 50 | 'fullname' => 'required|max:255', 51 | 'username' => 'required|max:15', 52 | 'email' => 'required|email:rfc,dns|unique:users,email', 53 | 'password' => 'required|confirmed|min:4', 54 | 'phone' => 'required|numeric', 55 | 'gender' => 'required', 56 | 'address' => 'required', 57 | ]); 58 | 59 | $validatedData['password'] = Hash::make($validatedData['password']); 60 | $validatedData['image'] = env("IMAGE_PROFILE"); 61 | $validatedData = array_merge($validatedData, [ 62 | "coupon" => 0, 63 | "point" => 0, 64 | 'remember_token' => Str::random(30), 65 | 'role_id' => 2 // value 2 for customer role 66 | ]); 67 | 68 | try { 69 | User::create($validatedData); 70 | $message = "Congratulations, your account has been created!"; 71 | 72 | myFlasherBuilder(message: $message, success: true); 73 | 74 | return redirect('/auth/login'); 75 | } catch (\Illuminate\Database\QueryException $exception) { 76 | return abort(500); 77 | } 78 | } 79 | 80 | 81 | public function logoutPost() 82 | { 83 | try { 84 | Auth::logout(); 85 | request()->session()->invalidate(); 86 | request()->session()->regenerateToken(); 87 | $message = "Session ended, you logout successfully"; 88 | 89 | myFlasherBuilder(message: $message, success: true); 90 | 91 | return redirect('/auth'); 92 | } catch (\Illuminate\Database\QueryException $exception) { 93 | return abort(500); 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /resources/views/auth/login.blade.php: -------------------------------------------------------------------------------- 1 | @extends('/layouts/auth') 2 | 3 | @push('css-dependencies') 4 | 5 | @endpush 6 | 7 | @section("content") 8 |
9 | 10 | 11 |
12 | 13 |
14 | 15 |
16 |
17 | 18 |
19 |
20 |
21 |
22 |

{{ $title }} Page

23 |
24 | 25 | @if(session()->has('message')) 26 | {!! session("message") !!} 27 | @endif 28 | 29 |
30 | @csrf 31 |
32 | 35 | @error('email') 36 |
{{ $message }}
37 | @enderror 38 |
39 |
40 | 43 | @error('password') 44 |
{{ $message }}
45 | @enderror 46 |
47 | 50 |
51 |
52 | 53 | 56 |
57 |
58 |
59 |
60 |
61 | 62 |
63 | 64 |
65 | 66 |
67 | @endsection -------------------------------------------------------------------------------- /public/js/product.js: -------------------------------------------------------------------------------- 1 | import { previewImage } from "/js/image_preview.js"; 2 | 3 | $("button.detail").click(function (event) { 4 | var id = $(this).attr("data-id"); 5 | setVisible("#loading", true); 6 | 7 | $.ajax({ 8 | url: "/product/data/" + id, 9 | method: "get", 10 | dataType: "json", 11 | success: function (res) { 12 | $("#modal-image").attr("src", "/storage/" + res["image"]); 13 | $(".text-uppercase").html(res["product_name"]); 14 | $(".orientation").html(res["orientation"]); 15 | $(".description").html(res["description"]); 16 | $(".stock").html( 17 | "Available: " + "" + res["stock"] + " unit" + "" 18 | ); 19 | if (res["discount"] == 0) { 20 | $(".price").html( 21 | "Price: " + "Rp. " + res["price"] + "" 22 | ); 23 | $(".discount").html( 24 | "Discount: " + 25 | "No discount available" 26 | ); 27 | } else { 28 | $(".price").html( 29 | "Price: " + 30 | "" + 31 | ((100 - res["discount"]) / 100) * res["price"] + 32 | "" + 33 | "" + 34 | res["price"] + 35 | "" 36 | ); 37 | $(".discount").html( 38 | "Discount: " + 39 | "" + 40 | res["discount"] + 41 | "%" + 42 | "" 43 | ); 44 | } 45 | 46 | $("#ProductDetailModal").modal("show"); 47 | setVisible("#loading", false); 48 | }, 49 | }); 50 | }); 51 | 52 | const setVisible = (elementOrSelector, visible) => 53 | ((typeof elementOrSelector === "string" 54 | ? document.querySelector(elementOrSelector) 55 | : elementOrSelector 56 | ).style.display = visible ? "block" : "none"); 57 | 58 | $("#image").on("change", function () { 59 | previewImage({ 60 | image: "image", 61 | image_preview: "image-preview", 62 | image_preview_alt: "Product Image", 63 | }); 64 | }); 65 | 66 | // cancel order 67 | $("#button_edit_product").click(function (e) { 68 | e.preventDefault(); 69 | Swal.fire({ 70 | title: "Are you sure?", 71 | text: "after this process, product data will be changed", 72 | icon: "warning", 73 | confirmButtonText: "Confirm", 74 | cancelButtonColor: "#d33", 75 | showCancelButton: true, 76 | confirmButtonColor: "#08a10b", 77 | timer: 10000, 78 | }).then((result) => { 79 | if (result.isConfirmed) { 80 | $("#form_edit_product").submit(); 81 | } else if (result.isDismissed) { 82 | Swal.fire("Action canceled", "", "info"); 83 | } 84 | }); 85 | }); 86 | -------------------------------------------------------------------------------- /resources/views/partials/home/home_admin.blade.php: -------------------------------------------------------------------------------- 1 |
2 |

Dashboard

3 | 6 |
7 |
8 |
9 |
Primary Card
10 | 14 |
15 |
16 |
17 |
18 |
Warning Card
19 | 23 |
24 |
25 |
26 |
27 |
Success Card
28 | 32 |
33 |
34 |
35 |
36 |
Danger Card
37 | 41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | 49 | Sales Chart 50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | 58 | Profits Chart 59 |
60 |
61 |
62 |
63 |
64 |
-------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | 'after_commit' => false, 43 | ], 44 | 45 | 'beanstalkd' => [ 46 | 'driver' => 'beanstalkd', 47 | 'host' => 'localhost', 48 | 'queue' => 'default', 49 | 'retry_after' => 90, 50 | 'block_for' => 0, 51 | 'after_commit' => false, 52 | ], 53 | 54 | 'sqs' => [ 55 | 'driver' => 'sqs', 56 | 'key' => env('AWS_ACCESS_KEY_ID'), 57 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 58 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 59 | 'queue' => env('SQS_QUEUE', 'default'), 60 | 'suffix' => env('SQS_SUFFIX'), 61 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 62 | 'after_commit' => false, 63 | ], 64 | 65 | 'redis' => [ 66 | 'driver' => 'redis', 67 | 'connection' => 'default', 68 | 'queue' => env('REDIS_QUEUE', 'default'), 69 | 'retry_after' => 90, 70 | 'block_for' => null, 71 | 'after_commit' => false, 72 | ], 73 | 74 | ], 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Failed Queue Jobs 79 | |-------------------------------------------------------------------------- 80 | | 81 | | These options configure the behavior of failed queue job logging so you 82 | | can control which database and table are used to store the jobs that 83 | | have failed. You may change them to any database / table you wish. 84 | | 85 | */ 86 | 87 | 'failed' => [ 88 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 89 | 'database' => env('DB_CONNECTION', 'mysql'), 90 | 'table' => 'failed_jobs', 91 | ], 92 | 93 | ]; 94 | -------------------------------------------------------------------------------- /app/Http/Controllers/RajaOngkirController.php: -------------------------------------------------------------------------------- 1 | "https://api.rajaongkir.com/starter/cost", 14 | CURLOPT_RETURNTRANSFER => true, 15 | CURLOPT_ENCODING => "", 16 | CURLOPT_MAXREDIRS => 10, 17 | CURLOPT_TIMEOUT => 30, 18 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, 19 | CURLOPT_CUSTOMREQUEST => "POST", 20 | CURLOPT_POSTFIELDS => "origin=" . $origin . "&destination=" . $destination . "&weight=" . $weight . "&courier=" . $courier, 21 | CURLOPT_HTTPHEADER => array( 22 | "content-type: application/x-www-form-urlencoded", 23 | "key: " . env("API_RAJAONGKIR") 24 | ), 25 | )); 26 | $response = curl_exec($curl); 27 | $err = curl_error($curl); 28 | curl_close($curl); 29 | if ($err) { 30 | return $err; 31 | } else { 32 | return $response; 33 | } 34 | } 35 | 36 | 37 | function _ongkir_get($data) 38 | { 39 | $curl = curl_init(); 40 | curl_setopt_array($curl, array( 41 | CURLOPT_URL => "http://api.rajaongkir.com/starter/" . $data, 42 | CURLOPT_RETURNTRANSFER => true, 43 | CURLOPT_ENCODING => "", 44 | CURLOPT_MAXREDIRS => 10, 45 | CURLOPT_TIMEOUT => 30, 46 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, 47 | CURLOPT_CUSTOMREQUEST => "GET", 48 | CURLOPT_HTTPHEADER => array( 49 | "key: " . env("API_RAJAONGKIR") 50 | ), 51 | )); 52 | $response = curl_exec($curl); 53 | $err = curl_error($curl); 54 | curl_close($curl); 55 | if ($err) { 56 | return $err; 57 | } else { 58 | return $response; 59 | } 60 | } 61 | 62 | 63 | public function province() 64 | { 65 | $province = $this->_ongkir_get('province'); 66 | $data = json_decode($province, true); 67 | header("Content-Type: application/json"); 68 | echo json_encode($data['rajaongkir']['results']); 69 | } 70 | 71 | public function city($province_id) 72 | { 73 | if (!empty($province_id)) { 74 | if (is_numeric($province_id)) { 75 | $city = $this->_ongkir_get('city?province=' . $province_id); 76 | $data = json_decode($city, true); 77 | echo json_encode($data['rajaongkir']['results']); 78 | } else { 79 | abort(404); 80 | } 81 | } else { 82 | abort(404); 83 | } 84 | } 85 | 86 | 87 | public function cost($origin, $destination, $quantity, $courier) 88 | { 89 | $weight = (int)$quantity * 300; // 300 gram/pieces for every product 90 | $price = $this->_ongkir_post($origin, $destination, $weight, $courier); 91 | $data = json_decode($price, true); 92 | echo json_encode($data['rajaongkir']["results"]); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /resources/views/profile/change_password.blade.php: -------------------------------------------------------------------------------- 1 | @extends('/layouts/main') 2 | 3 | @push('css-dependencies') 4 | 5 | @endpush 6 | 7 | @section('content') 8 |
9 | 10 | @include('/partials/breadcumb') 11 | 12 |
13 | @if(session()->has('message')) 14 | {!! session("message") !!} 15 | @endif 16 |
17 | 18 |
19 |
20 |
21 |
22 |
23 | 27 | 63 |
64 |
65 |
66 |
67 |
68 |
69 | @endsection -------------------------------------------------------------------------------- /app/Http/Controllers/ReviewController.php: -------------------------------------------------------------------------------- 1 | review; 15 | 16 | $user = auth()->user(); 17 | 18 | if (count($reviews) == 0) { 19 | $rate = 0; 20 | } else { 21 | $rate = $reviews->sum("rating") / count($reviews); 22 | } 23 | 24 | $isPurchased = $this->isPurchased($user, $product); 25 | $isReviewed = $this->isReviewed($user, $product); 26 | 27 | $starCounter = []; 28 | $sum = 0; 29 | for ($i = 1; $i <= 5; $i++) { 30 | $total = count(Review::where(["rating" => $i, "product_id" => $product->id])->get()); 31 | array_push($starCounter, $total); 32 | $sum += $total; 33 | } 34 | 35 | return view("/review/product_review", compact("title", "reviews", "product", "rate", "isPurchased", "isReviewed", "starCounter", "sum")); 36 | } 37 | 38 | 39 | public function addReview(Request $request) 40 | { 41 | $validatedData = $request->validate([ 42 | "rating" => "required", 43 | "review" => "required" 44 | ]); 45 | 46 | $validatedData["user_id"] = auth()->user()->id; 47 | $validatedData["product_id"] = $request->product_id; 48 | $validatedData["is_edit"] = 0; 49 | 50 | Review::create($validatedData); 51 | 52 | $message = "Your review has been created!"; 53 | 54 | myFlasherBuilder(message: $message, success: true); 55 | return back(); 56 | } 57 | 58 | 59 | public function getDataReview(Review $review) 60 | { 61 | return $review; 62 | } 63 | 64 | 65 | public function editReview(Request $request, Review $review) 66 | { 67 | $review->fill([ 68 | 'rating' => $request->rating, 69 | 'review' => $request->review_edit, 70 | 'is_edit' => 1, 71 | ]); 72 | 73 | if ($review->isDirty()) { 74 | $review->save(); 75 | 76 | $message = "Your review has been updated!"; 77 | 78 | myFlasherBuilder(message: $message, success: true); 79 | return back(); 80 | } else { 81 | $message = "Action failed, no changes detected!"; 82 | 83 | myFlasherBuilder(message: $message, failed: true); 84 | return back(); 85 | } 86 | } 87 | 88 | 89 | public function deleteReview(Review $review) 90 | { 91 | $review->delete(); 92 | 93 | $message = "Your review has been deleted!"; 94 | 95 | myFlasherBuilder(message: $message, success: true); 96 | return back(); 97 | } 98 | 99 | private function isPurchased($user, $product) 100 | { 101 | $orders = Order::where(["user_id" => $user->id, "product_id" => $product->id, "is_done" => 1])->get(); 102 | 103 | if (count($orders) > 0) { 104 | return 1; 105 | } 106 | 107 | return 0; 108 | } 109 | 110 | 111 | private function isReviewed($user, $product) 112 | { 113 | $review = Review::where(["user_id" => $user->id, "product_id" => $product->id])->get(); 114 | 115 | if (count($review) > 0) { 116 | return 1; 117 | } 118 | 119 | return 0; 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /resources/views/profile/my_profile.blade.php: -------------------------------------------------------------------------------- 1 | @extends('/layouts/main') 2 | 3 | @push('css-dependencies') 4 | 5 | @endpush 6 | 7 | @section('content') 8 |
9 | 10 | @include('/partials/breadcumb') 11 | 12 |
13 |
14 | 15 |
16 |
17 |
18 | 19 |
20 |

{{ auth()->user()->username }}

21 |

{{ auth()->user()->role->role_name }}

22 |

User since {{ auth()->user()->created_at->format('d M Y') 23 | }}

24 |
25 |
26 |
27 |
28 |
29 | 30 |
31 |
32 |
33 |
34 |
35 |
Full Name
36 |
37 |
38 | {{ auth()->user()->fullname }} 39 |
40 |
41 |
42 |
43 |
44 |
Email
45 |
46 |
47 | {{ auth()->user()->email }} 48 |
49 |
50 |
51 |
52 |
53 |
Phone
54 |
55 |
56 | {{ auth()->user()->phone }} 57 |
58 |
59 |
60 |
61 |
62 |
Gender
63 |
64 |
65 | {{ auth()->user()->gender == "M" ? "Male" : "Female" }} 66 |
67 |
68 |
69 |
70 |
71 |
Address
72 |
73 |
74 | {{ auth()->user()->address}} 75 |
76 |
77 |
78 |
79 |
80 | Edit Profile 81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | @endsection -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | | Supported drivers: "apc", "array", "database", "file", 30 | | "memcached", "redis", "dynamodb", "octane", "null" 31 | | 32 | */ 33 | 34 | 'stores' => [ 35 | 36 | 'apc' => [ 37 | 'driver' => 'apc', 38 | ], 39 | 40 | 'array' => [ 41 | 'driver' => 'array', 42 | 'serialize' => false, 43 | ], 44 | 45 | 'database' => [ 46 | 'driver' => 'database', 47 | 'table' => 'cache', 48 | 'connection' => null, 49 | 'lock_connection' => null, 50 | ], 51 | 52 | 'file' => [ 53 | 'driver' => 'file', 54 | 'path' => storage_path('framework/cache/data'), 55 | ], 56 | 57 | 'memcached' => [ 58 | 'driver' => 'memcached', 59 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 60 | 'sasl' => [ 61 | env('MEMCACHED_USERNAME'), 62 | env('MEMCACHED_PASSWORD'), 63 | ], 64 | 'options' => [ 65 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 66 | ], 67 | 'servers' => [ 68 | [ 69 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 70 | 'port' => env('MEMCACHED_PORT', 11211), 71 | 'weight' => 100, 72 | ], 73 | ], 74 | ], 75 | 76 | 'redis' => [ 77 | 'driver' => 'redis', 78 | 'connection' => 'cache', 79 | 'lock_connection' => 'default', 80 | ], 81 | 82 | 'dynamodb' => [ 83 | 'driver' => 'dynamodb', 84 | 'key' => env('AWS_ACCESS_KEY_ID'), 85 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 86 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 87 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 88 | 'endpoint' => env('DYNAMODB_ENDPOINT'), 89 | ], 90 | 91 | 'octane' => [ 92 | 'driver' => 'octane', 93 | ], 94 | 95 | ], 96 | 97 | /* 98 | |-------------------------------------------------------------------------- 99 | | Cache Key Prefix 100 | |-------------------------------------------------------------------------- 101 | | 102 | | When utilizing the APC, database, memcached, Redis, or DynamoDB cache 103 | | stores there might be other applications using the same cache. For 104 | | that reason, you may prefix every cache key to avoid collisions. 105 | | 106 | */ 107 | 108 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), 109 | 110 | ]; 111 | -------------------------------------------------------------------------------- /app/Http/Controllers/ProfileController.php: -------------------------------------------------------------------------------- 1 | 'required|max:255', 33 | 'phone' => 'required|numeric', 34 | 'address' => 'required', 35 | ]; 36 | 37 | 38 | if (auth()->user()->username != $request->username) { 39 | $rules['username'] = 'required|max:15|unique:users,username'; 40 | } else { 41 | $rules['username'] = 'required|max:15'; 42 | } 43 | 44 | if ($request->file("image")) { 45 | $rules["image"] = "image|file|max:2048"; 46 | } 47 | 48 | $validatedData = $request->validate($rules); 49 | 50 | try { 51 | if ($request->file("image")) { 52 | if ($request->oldImage != env("IMAGE_PROFILE")) { 53 | Storage::delete($request->oldImage); 54 | } 55 | 56 | $validatedData["image"] = $request->file("image")->store("profile"); 57 | } 58 | 59 | $user->fill($validatedData); 60 | 61 | if ($user->isDirty()) { 62 | $user->save(); 63 | 64 | $message = "Your profile has been updated!"; 65 | 66 | myFlasherBuilder(message: $message, success: true); 67 | return redirect("/home"); 68 | } else { 69 | $message = "Action failed, no changes detected!"; 70 | 71 | myFlasherBuilder(message: $message, failed: true); 72 | return redirect("/profile/edit_profile"); 73 | } 74 | } catch (Exception $exception) { 75 | return abort(500); 76 | } 77 | } 78 | 79 | 80 | public function changePasswordGet() 81 | { 82 | $title = "Change Password"; 83 | 84 | return view("/profile/change_password", compact("title")); 85 | } 86 | 87 | 88 | public function changePasswordPost(Request $request) 89 | { 90 | $validated = $request->validate([ 91 | "current_password" => "required|min:4", 92 | "password" => "required|confirmed|min:4", 93 | "password_confirmation" => "required|min:4", 94 | ]); 95 | 96 | if (!(Hash::check($request->current_password, auth()->user()->password))) { 97 | $message = "Current password is wrong!"; 98 | 99 | myFlasherBuilder(message: $message, failed: true); 100 | return back(); 101 | } else if ($request->current_password == $request->password) { 102 | $message = "Current password cannot be the same as new password!"; 103 | 104 | myFlasherBuilder(message: $message, failed: true); 105 | return back(); 106 | } 107 | 108 | User::where('id', auth()->user()->id) 109 | ->update(['password' => Hash::make($validated['password'])]); 110 | 111 | $message = "Password has been updated"; 112 | 113 | myFlasherBuilder(message: $message, success: true); 114 | return redirect("/home"); 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /public/css/landing.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css?family=Varela+Round"); 2 | @import url("https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"); 3 | 4 | * { 5 | margin: 0; 6 | padding: 0; 7 | box-sizing: border-box; 8 | } 9 | 10 | html { 11 | scroll-padding-top: calc(4.5rem - 1px) !important; 12 | } 13 | 14 | body { 15 | letter-spacing: 0.0625em !important; 16 | } 17 | 18 | .btn { 19 | box-shadow: 0 0.1875rem 0.1875rem 0 rgba(0, 0, 0, 0.1) !important; 20 | padding: 1.25rem 2rem; 21 | font-family: "Varela Round", -apple-system, BlinkMacSystemFont, "Segoe UI", 22 | Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", 23 | "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !important; 24 | font-size: 80%; 25 | text-transform: uppercase; 26 | letter-spacing: 0.15rem; 27 | border: 0; 28 | } 29 | 30 | .btn-primary { 31 | color: #fff; 32 | background-color: #64a19d !important; 33 | border-color: #64a19d !important; 34 | } 35 | .btn-primary:hover { 36 | color: #fff; 37 | background-color: #558985 !important; 38 | border-color: #50817e !important; 39 | } 40 | .btn-check:focus + .btn-primary, 41 | .btn-primary:focus { 42 | color: #fff; 43 | background-color: #558985 !important; 44 | border-color: #50817e !important; 45 | box-shadow: 0 0 0 0.25rem rgba(123, 175, 172, 0.5) !important; 46 | } 47 | .btn-check:checked + .btn-primary, 48 | .btn-check:active + .btn-primary, 49 | .btn-primary:active, 50 | .btn-primary.active, 51 | .show > .btn-primary.dropdown-toggle { 52 | color: #fff; 53 | background-color: #50817e; 54 | border-color: #4b7976; 55 | } 56 | .btn-check:checked + .btn-primary:focus, 57 | .btn-check:active + .btn-primary:focus, 58 | .btn-primary:active:focus, 59 | .btn-primary.active:focus, 60 | .show > .btn-primary.dropdown-toggle:focus { 61 | box-shadow: 0 0 0 0.25rem rgba(123, 175, 172, 0.5); 62 | } 63 | .btn-primary:disabled, 64 | .btn-primary.disabled { 65 | color: #fff; 66 | background-color: #64a19d; 67 | border-color: #64a19d; 68 | } 69 | 70 | .masthead { 71 | width: 100%; 72 | height: auto; 73 | min-height: 35rem; 74 | padding: 15rem 0; 75 | background: linear-gradient( 76 | to bottom, 77 | rgba(0, 0, 0, 0.3) 0%, 78 | rgba(0, 0, 0, 0.7) 75%, 79 | #000 100% 80 | ), 81 | url("/storage/landing/landing-background.jpg"); 82 | background-position: 3% 50%; 83 | background-repeat: no-repeat; 84 | background-attachment: scroll; 85 | background-size: 110% 110%; 86 | } 87 | .masthead h1, 88 | .masthead .h1 { 89 | font-family: "Varela Round", -apple-system, BlinkMacSystemFont, "Segoe UI", 90 | Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", 91 | "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !important; 92 | font-size: 2.5rem; 93 | line-height: 2.5rem; 94 | letter-spacing: 0.8rem; 95 | background: linear-gradient( 96 | rgba(255, 255, 255, 0.9), 97 | rgba(255, 255, 255, 0) 98 | ); 99 | -webkit-text-fill-color: transparent; 100 | -webkit-background-clip: text; 101 | background-clip: text; 102 | } 103 | .masthead h2, 104 | .masthead .h2 { 105 | max-width: 20rem; 106 | font-size: 1rem; 107 | } 108 | @media (min-width: 768px) { 109 | .masthead h1, 110 | .masthead .h1 { 111 | font-size: 4rem; 112 | line-height: 4rem; 113 | } 114 | } 115 | @media (min-width: 992px) { 116 | .masthead { 117 | height: 100vh; 118 | padding: 0; 119 | } 120 | .masthead h1, 121 | .masthead .h1 { 122 | font-size: 6.5rem; 123 | line-height: 6.5rem; 124 | letter-spacing: 0.8rem; 125 | } 126 | .masthead h2, 127 | .masthead .h2 { 128 | max-width: 30rem; 129 | font-size: 1.25rem; 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /storage/app/public/icons/bank-bri.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/Http/Controllers/ProductController.php: -------------------------------------------------------------------------------- 1 | validate([ 39 | "product_name" => "required|max:25", 40 | "stock" => "required|numeric|gt:0", 41 | "price" => "required|numeric|gt:0", 42 | "discount" => "required|numeric|gt:0|lt:100", 43 | "orientation" => "required", 44 | "description" => "required", 45 | "image" => "image|max:2048" 46 | ]); 47 | 48 | if (!isset($validatedData["image"])) { 49 | $validatedData["image"] = env("IMAGE_PRODUCT"); 50 | } else { 51 | $validatedData["image"] = $request->file("image")->store("product"); 52 | } 53 | 54 | try { 55 | Product::create($validatedData); 56 | $message = "Product has been added!"; 57 | 58 | myFlasherBuilder(message: $message, success: true); 59 | 60 | return redirect('/product'); 61 | } catch (\Illuminate\Database\QueryException $exception) { 62 | return abort(500); 63 | } 64 | } 65 | 66 | 67 | public function editProductGet(Product $product) 68 | { 69 | $data["title"] = "Edit Product"; 70 | $data["product"] = $product; 71 | 72 | return view("/product/edit_product", $data); 73 | } 74 | 75 | 76 | public function editProductPost(Request $request, Product $product) 77 | { 78 | $rules = [ 79 | 'orientation' => 'required', 80 | 'description' => 'required', 81 | 'price' => 'required|numeric|gt:0', 82 | 'stock' => 'required|numeric|gt:0', 83 | 'discount' => 'required|numeric|gt:0|lt:100', 84 | 'image' => 'image|file|max:2048' 85 | ]; 86 | 87 | 88 | if ($product->product_name != $request->product_name) { 89 | $rules['product_name'] = 'required|max:25|unique:products,product_name'; 90 | } else { 91 | $rules['product_name'] = 'required|max:25'; 92 | } 93 | 94 | $validatedData = $request->validate($rules); 95 | 96 | try { 97 | if ($request->file("image")) { 98 | if ($request->oldImage != env("IMAGE_PRODUCT")) { 99 | Storage::delete($request->oldImage); 100 | } 101 | 102 | $validatedData["image"] = $request->file("image")->store("product"); 103 | } 104 | 105 | $product->fill($validatedData); 106 | 107 | 108 | if ($product->isDirty()) { 109 | $product->save(); 110 | 111 | $message = "Product has been updated!"; 112 | 113 | myFlasherBuilder(message: $message, success: true); 114 | return redirect("/product"); 115 | } else { 116 | $message = "Action failed, no changes detected!"; 117 | 118 | myFlasherBuilder(message: $message, failed: true); 119 | return back(); 120 | } 121 | } catch (\Illuminate\Database\QueryException $exception) { 122 | return abort(500); 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_MAILER', 'smtp'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Mailer Configurations 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure all of the mailers used by your application plus 24 | | their respective settings. Several examples have been configured for 25 | | you and you are free to add your own as your application requires. 26 | | 27 | | Laravel supports a variety of mail "transport" drivers to be used while 28 | | sending an e-mail. You will specify which one you are using for your 29 | | mailers below. You are free to add additional mailers as required. 30 | | 31 | | Supported: "smtp", "sendmail", "mailgun", "ses", 32 | | "postmark", "log", "array", "failover" 33 | | 34 | */ 35 | 36 | 'mailers' => [ 37 | 'smtp' => [ 38 | 'transport' => 'smtp', 39 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 40 | 'port' => env('MAIL_PORT', 587), 41 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 42 | 'username' => env('MAIL_USERNAME'), 43 | 'password' => env('MAIL_PASSWORD'), 44 | 'timeout' => null, 45 | 'local_domain' => env('MAIL_EHLO_DOMAIN'), 46 | ], 47 | 48 | 'ses' => [ 49 | 'transport' => 'ses', 50 | ], 51 | 52 | 'mailgun' => [ 53 | 'transport' => 'mailgun', 54 | ], 55 | 56 | 'postmark' => [ 57 | 'transport' => 'postmark', 58 | ], 59 | 60 | 'sendmail' => [ 61 | 'transport' => 'sendmail', 62 | 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), 63 | ], 64 | 65 | 'log' => [ 66 | 'transport' => 'log', 67 | 'channel' => env('MAIL_LOG_CHANNEL'), 68 | ], 69 | 70 | 'array' => [ 71 | 'transport' => 'array', 72 | ], 73 | 74 | 'failover' => [ 75 | 'transport' => 'failover', 76 | 'mailers' => [ 77 | 'smtp', 78 | 'log', 79 | ], 80 | ], 81 | ], 82 | 83 | /* 84 | |-------------------------------------------------------------------------- 85 | | Global "From" Address 86 | |-------------------------------------------------------------------------- 87 | | 88 | | You may wish for all e-mails sent by your application to be sent from 89 | | the same address. Here, you may specify a name and address that is 90 | | used globally for all e-mails that are sent by your application. 91 | | 92 | */ 93 | 94 | 'from' => [ 95 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 96 | 'name' => env('MAIL_FROM_NAME', 'Example'), 97 | ], 98 | 99 | /* 100 | |-------------------------------------------------------------------------- 101 | | Markdown Mail Settings 102 | |-------------------------------------------------------------------------- 103 | | 104 | | If you are using Markdown based email rendering, you may configure your 105 | | theme and component paths here, allowing you to customize the design 106 | | of the emails. Or, you may simply stick with the Laravel defaults! 107 | | 108 | */ 109 | 110 | 'markdown' => [ 111 | 'theme' => 'default', 112 | 113 | 'paths' => [ 114 | resource_path('views/vendor/mail'), 115 | ], 116 | ], 117 | 118 | ]; 119 | -------------------------------------------------------------------------------- /resources/views/product/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('/layouts/main') 2 | 3 | @push('css-dependencies') 4 | 5 | @endpush 6 | 7 | @push('scripts-dependencies') 8 | 9 | @endpush 10 | 11 | @push('modals-dependencies') 12 | @include('/partials/product/product_detail_modal') 13 | @endpush 14 | 15 | @section('content') 16 | 17 |
18 |
19 | 20 | @if(session()->has('message')) 21 | {!! session("message") !!} 22 | @endif 23 | 24 |
Our Product
25 | @can('add_product',App\Models\Product::class) 26 |
27 | 28 |
pe
29 |
30 |
31 | @else 32 |
33 | @endcan 34 | 35 |
36 | @foreach($product as $row) 37 | 38 |
39 |
40 |
41 |
42 |
43 |
44 |

Product Name

46 |

{{ $row->product_name }}

47 |

{{ $row->orientation }}

48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |

{{ $row->product_name }}

56 |

Lorem ipsum dolor sit amet consectetur adipisicing elit. 57 | Doloremque nam voluptas distinctio facere assumenda delectus.

58 | 59 | 60 | 62 | 63 | 64 | 66 | 67 | 68 | @can('edit_product',App\Models\Product::class) 69 | 71 | @endcan 72 | @can('create_order',App\Models\Order::class) 73 | 75 | @endcan 76 |
77 |
78 |
79 |
80 |
81 |
82 | 83 | @endforeach 84 |
85 |
86 |
87 | 88 | 89 | @endsection -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | ], 44 | 45 | /* 46 | |-------------------------------------------------------------------------- 47 | | User Providers 48 | |-------------------------------------------------------------------------- 49 | | 50 | | All authentication drivers have a user provider. This defines how the 51 | | users are actually retrieved out of your database or other storage 52 | | mechanisms used by this application to persist your user's data. 53 | | 54 | | If you have multiple user tables or models you may configure multiple 55 | | sources which represent each model / table. These sources may then 56 | | be assigned to any extra authentication guards you have defined. 57 | | 58 | | Supported: "database", "eloquent" 59 | | 60 | */ 61 | 62 | 'providers' => [ 63 | 'users' => [ 64 | 'driver' => 'eloquent', 65 | 'model' => App\Models\User::class, 66 | ], 67 | 68 | // 'users' => [ 69 | // 'driver' => 'database', 70 | // 'table' => 'users', 71 | // ], 72 | ], 73 | 74 | /* 75 | |-------------------------------------------------------------------------- 76 | | Resetting Passwords 77 | |-------------------------------------------------------------------------- 78 | | 79 | | You may specify multiple password reset configurations if you have more 80 | | than one user table or model in the application and you want to have 81 | | separate password reset settings based on the specific user types. 82 | | 83 | | The expire time is the number of minutes that each reset token will be 84 | | considered valid. This security feature keeps tokens short-lived so 85 | | they have less time to be guessed. You may change this as needed. 86 | | 87 | */ 88 | 89 | 'passwords' => [ 90 | 'users' => [ 91 | 'provider' => 'users', 92 | 'table' => 'password_resets', 93 | 'expire' => 60, 94 | 'throttle' => 60, 95 | ], 96 | ], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Password Confirmation Timeout 101 | |-------------------------------------------------------------------------- 102 | | 103 | | Here you may define the amount of seconds before a password confirmation 104 | | times out and the user is prompted to re-enter their password via the 105 | | confirmation screen. By default, the timeout lasts for three hours. 106 | | 107 | */ 108 | 109 | 'password_timeout' => 10800, 110 | 111 | ]; 112 | -------------------------------------------------------------------------------- /resources/views/transaction/add_outcome.blade.php: -------------------------------------------------------------------------------- 1 | @extends('/layouts/main') 2 | 3 | @section('content') 4 |
5 | 6 | @include('/partials/breadcumb') 7 | 8 | @if(session()->has('message')) 9 | {!! session("message") !!} 10 | @endif 11 | 12 | 13 |
14 | 15 |
16 |
17 |
18 |
19 |
20 |
21 | 24 | 25 | 26 |
27 | @csrf 28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | 36 | 43 | @error('category_id') 44 |
{{ $message }}
45 | @enderror 46 |
47 |
48 |
49 |
50 | 51 | 53 | @error('outcome') 54 |
{{ $message }}
55 | @enderror 56 |
57 |
58 |
59 |
60 |
61 |
62 | 63 | 65 | @error('description') 66 |
{{ $message }}
67 | @enderror 68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | Back to Transaction List 76 | 77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 | @endsection --------------------------------------------------------------------------------