diff --git a/.env.example b/.env.example index d0d423c..1458263 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ -APP_NAME='Template App' +APP_NAME='Simple POS' APP_ENV=local APP_KEY= APP_DEBUG=true diff --git a/app/Http/Controllers/GeneralController.php b/app/Http/Controllers/GeneralController.php index b318182..aa9b742 100644 --- a/app/Http/Controllers/GeneralController.php +++ b/app/Http/Controllers/GeneralController.php @@ -42,7 +42,8 @@ class GeneralController extends Controller ->orderBy('date', 'asc') ->groupBy('date') ->get(); - $target = (Setting::where('key', 'target')->value('value') ?? 90000) / 30; + $originTarget = (Setting::where('key', 'target')->value('value') ?? 90000); + $target = $originTarget / 30; $dounat = SaleItem::selectRaw('product_id, category_id, SUM(quantity) as qty') ->with('product.category') @@ -79,7 +80,8 @@ class GeneralController extends Controller 'list_customer' => $transactionCustomers, 'month' => now()->locale('id')->translatedFormat('F'), 'total_sale_month' => $totalSaleMonth, - 'targets' => [$target, $target, $target, $target, $target, $target, $target, $target] + 'targets' => [$target, $target, $target, $target, $target, $target, $target, $target], + 'target' => $originTarget, ]); } diff --git a/app/Http/Controllers/SaleController.php b/app/Http/Controllers/SaleController.php index 68d1595..0849782 100644 --- a/app/Http/Controllers/SaleController.php +++ b/app/Http/Controllers/SaleController.php @@ -94,7 +94,7 @@ class SaleController extends Controller DB::rollBack(); return redirect()->back() - ->with('message', ['type' => 'error', 'message' => 'Stok barang tidak cukup']); + ->with('message', ['type' => 'error', 'message' => 'Stok produk tidak cukup']); } $product->update(['stock' => $stock]); } diff --git a/resources/js/Components/Defaults/ApplicationLogo.jsx b/resources/js/Components/Defaults/ApplicationLogo.jsx index c240884..cfb03bc 100644 --- a/resources/js/Components/Defaults/ApplicationLogo.jsx +++ b/resources/js/Components/Defaults/ApplicationLogo.jsx @@ -1,10 +1,9 @@ +import { usePage } from '@inertiajs/react' import React from 'react' export default function ApplicationLogo({ className }) { - return ( -

- {' '} - Sistem Informasi Penjualan PT. Maju Jaya Kreasindo -

- ) + const { + props: { app_name }, + } = usePage() + return

{app_name}

} diff --git a/resources/js/Components/HeadInput.jsx b/resources/js/Components/HeadInput.jsx index 3d10596..9e7392f 100644 --- a/resources/js/Components/HeadInput.jsx +++ b/resources/js/Components/HeadInput.jsx @@ -1,17 +1,18 @@ -import React from "react"; -import { HiOutlineDotsVertical } from "react-icons/hi"; +import React from 'react' +import { HiOutlineDotsVertical } from 'react-icons/hi' export default function HeadInput({ onClick }) { return (
- - +
) -} \ No newline at end of file +} diff --git a/resources/js/Layouts/AuthenticatedLayout.jsx b/resources/js/Layouts/AuthenticatedLayout.jsx index d4b6dff..daf9184 100644 --- a/resources/js/Layouts/AuthenticatedLayout.jsx +++ b/resources/js/Layouts/AuthenticatedLayout.jsx @@ -1,24 +1,38 @@ -import React, { useState, useEffect } from 'react'; -import { ToastContainer, toast } from 'react-toastify'; -import ApplicationLogo from '@/Components/Defaults/ApplicationLogo'; -import Dropdown from '@/Components/Defaults/Dropdown'; -import { Link } from '@inertiajs/react'; -import { Breadcrumb } from 'flowbite-react'; +import React, { useState, useEffect } from 'react' +import { ToastContainer, toast } from 'react-toastify' +import ApplicationLogo from '@/Components/Defaults/ApplicationLogo' +import Dropdown from '@/Components/Defaults/Dropdown' +import { Link } from '@inertiajs/react' +import { Breadcrumb } from 'flowbite-react' import { HiMenu, HiChevronDown, HiHome } from 'react-icons/hi' -import { router } from '@inertiajs/react'; -import SidebarNav from './Partials/SidebarNav'; +import { router } from '@inertiajs/react' +import SidebarNav from './Partials/SidebarNav' -export default function Authenticated({ auth, children, flash, page = '', action = ''}) { - const [showingNavigationDropdown, setShowingNavigationDropdown] = useState(false); +export default function Authenticated({ + auth, + children, + flash, + page = '', + action = '', +}) { + const [showingNavigationDropdown, setShowingNavigationDropdown] = + useState(false) useEffect(() => { if (flash.message !== null) { - toast(flash.message.message, {type: flash.message.type}) + toast(flash.message.message, { type: flash.message.type }) } }, [flash]) + console.log( + 'APLIKASI INI DIJUAL DENGAN HARGA 1JT RUPIAH, JIKA DIJUAL LEBIH MAHAL SILAHKAN HUBUNGI KREATOR DI +6281325307692 (WA)' + ) + return ( -
+
- -
-
- +
+
+
-
+
{page !== '' && ( - + router.visit(route('dashboard'))} icon={HiHome} > -

{page}

+

{page}

{action !== '' && ( - - {action} - + {action} )}
)} -
- {children} -
+
{children}
- ); + ) } diff --git a/resources/js/Layouts/GuestLayout.jsx b/resources/js/Layouts/GuestLayout.jsx index 5da1f79..b634a33 100644 --- a/resources/js/Layouts/GuestLayout.jsx +++ b/resources/js/Layouts/GuestLayout.jsx @@ -5,11 +5,12 @@ import { Link } from '@inertiajs/react' export default function Guest({ children }) { return ( -
-
- - app logo - +
+
+
diff --git a/resources/js/Pages/Dashboard.jsx b/resources/js/Pages/Dashboard.jsx index fa004cd..b3e2918 100644 --- a/resources/js/Pages/Dashboard.jsx +++ b/resources/js/Pages/Dashboard.jsx @@ -37,6 +37,7 @@ export default function Dashboard(props) { month, total_sale_month, targets, + target, } = props const options = { @@ -142,6 +143,15 @@ export default function Dashboard(props) {
+
+
+ Target Penjualan
+ Bulan {month} +
+
+ Rp. {formatIDR(target)} +
+
Total Penjualan
@@ -153,7 +163,7 @@ export default function Dashboard(props) {
- Total Barang Terjual
+ Total Penjualan
Hari Ini
@@ -162,19 +172,13 @@ export default function Dashboard(props) {
- Jumlah Barang Terjual
+ Jumlah Produk Terjual
Hari Ini
{total_item_today}
-
-
Jumlah Pelanggan
-
- {total_customer} -
-
{/* Chart : jumlah transaksi 7 hari terkahir */}
@@ -271,7 +275,7 @@ export default function Dashboard(props) { : 'Umum'} - {formatIDR(customer.stotal)} + Rp. {formatIDR(customer.stotal)} ))} diff --git a/resources/js/Pages/Sale/Show.jsx b/resources/js/Pages/Sale/Show.jsx index 083a702..5c53d62 100644 --- a/resources/js/Pages/Sale/Show.jsx +++ b/resources/js/Pages/Sale/Show.jsx @@ -1,12 +1,12 @@ -import React from 'react'; -import { Head } from '@inertiajs/react'; +import React from 'react' +import { Head } from '@inertiajs/react' -import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout'; -import { formatDate, formatIDR } from '@/utils'; +import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout' +import { formatDate, formatIDR } from '@/utils' export default function Sale(props) { const { sale, auth } = props - + return (
-
-
Date : {formatDate(sale.date)}
-
Customer : {sale.customer?.name}
-
Total : {formatIDR(sale.total)}
+
+
+ Date : {formatDate(sale.date)} +
+
+ Customer : {sale.customer?.name} +
+
+ Total : {formatIDR(sale.total)} +
-
+
- - - - - {sale?.items?.map(item => ( - - + ))} @@ -69,5 +97,5 @@ export default function Sale(props) { - ); -} \ No newline at end of file + ) +}
- Barang + + Produk + Harga + Jumlah + Subtotal
- {item.product.name} ({item.product.code}) + {sale?.items?.map((item) => ( +
+ {item.product.name} ( + {item.product.code}) {formatIDR(item.price)} @@ -57,7 +82,10 @@ export default function Sale(props) { {formatIDR(item.quantity)} - {formatIDR(item.quantity * item.price)} + {formatIDR( + item.quantity * + item.price + )}