diff --git a/app/Modules/Inventory/Controllers/WarehouseController.php b/app/Modules/Inventory/Controllers/WarehouseController.php index 976fbe4..a1391b5 100644 --- a/app/Modules/Inventory/Controllers/WarehouseController.php +++ b/app/Modules/Inventory/Controllers/WarehouseController.php @@ -37,6 +37,12 @@ class WarehouseController extends Controller ->orWhere('expiry_date', '>=', now()); }); }], 'quantity') + ->addSelect(['low_stock_count' => function ($query) { + $query->selectRaw('count(*)') + ->from('warehouse_product_safety_stocks as ss') + ->whereColumn('ss.warehouse_id', 'warehouses.id') + ->whereRaw('(SELECT COALESCE(SUM(quantity), 0) FROM inventories WHERE warehouse_id = ss.warehouse_id AND product_id = ss.product_id) < ss.safety_stock'); + }]) ->orderBy('created_at', 'desc') ->paginate(10) ->withQueryString(); diff --git a/resources/js/Components/ApplicationLogo.tsx b/resources/js/Components/ApplicationLogo.tsx index 85b1438..cc7dc0b 100644 --- a/resources/js/Components/ApplicationLogo.tsx +++ b/resources/js/Components/ApplicationLogo.tsx @@ -21,7 +21,7 @@ export default function ApplicationLogo(props: ImgHTMLAttributes ); } diff --git a/resources/js/Layouts/AuthenticatedLayout.tsx b/resources/js/Layouts/AuthenticatedLayout.tsx index 039d081..b10dc70 100644 --- a/resources/js/Layouts/AuthenticatedLayout.tsx +++ b/resources/js/Layouts/AuthenticatedLayout.tsx @@ -454,7 +454,7 @@ export default function AuthenticatedLayout({ - {branding?.short_name || '小小冰室'} ERP + {branding?.short_name || 'Star'} ERP @@ -510,7 +510,7 @@ export default function AuthenticatedLayout({ {!isCollapsed && ( - {branding?.short_name || '小小冰室'} ERP + {branding?.short_name || 'Star'} ERP )} {isCollapsed && ( @@ -559,7 +559,7 @@ export default function AuthenticatedLayout({
- {branding?.short_name || '小小冰室'} ERP + {branding?.short_name || 'Star'} ERP
- Copyright © {new Date().getFullYear()} {branding?.name || '小小冰室'}. All rights reserved. Design by 星科技 + Copyright © {new Date().getFullYear()} {branding?.name || branding?.short_name || 'Star ERP'}. All rights reserved. Design by 星科技
diff --git a/resources/js/Pages/Auth/Login.tsx b/resources/js/Pages/Auth/Login.tsx index 0e07aa7..098b722 100644 --- a/resources/js/Pages/Auth/Login.tsx +++ b/resources/js/Pages/Auth/Login.tsx @@ -42,7 +42,7 @@ export default function Login() { return (
- + @@ -136,7 +136,7 @@ export default function Login() {

- © {new Date().getFullYear()} {props.branding?.name || '小小冰室'}. All rights reserved. + © {new Date().getFullYear()} {props.branding?.name || props.branding?.short_name || 'Star ERP'}. All rights reserved.

diff --git a/resources/js/Pages/Dashboard.tsx b/resources/js/Pages/Dashboard.tsx index 662450a..baab9f3 100644 --- a/resources/js/Pages/Dashboard.tsx +++ b/resources/js/Pages/Dashboard.tsx @@ -1,5 +1,6 @@ import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout'; -import { Link, Head } from '@inertiajs/react'; +import { Link, Head, usePage } from '@inertiajs/react'; +import { PageProps } from '@/types/global'; import { cn } from "@/lib/utils"; import { Package, @@ -27,6 +28,7 @@ interface Props { } export default function Dashboard({ stats }: Props) { + const { branding } = usePage().props; const cardData = [ { label: '商品總數', @@ -75,7 +77,7 @@ export default function Dashboard({ stats }: Props) { return ( - +
@@ -83,7 +85,7 @@ export default function Dashboard({ stats }: Props) { 系統總覽 -

歡迎回來,這是您的小小冰室 ERP 營運數據概況。

+

歡迎回來,這是您的 {branding?.short_name || 'Star'} ERP 營運數據概況。

{/* 主要數據卡片 */} diff --git a/resources/js/Pages/Product/Index.tsx b/resources/js/Pages/Product/Index.tsx index a27506a..662673d 100644 --- a/resources/js/Pages/Product/Index.tsx +++ b/resources/js/Pages/Product/Index.tsx @@ -8,7 +8,8 @@ import ProductDialog from "@/Components/Product/ProductDialog"; import CategoryManagerDialog from "@/Components/Category/CategoryManagerDialog"; import UnitManagerDialog, { Unit } from "@/Components/Unit/UnitManagerDialog"; import AuthenticatedLayout from "@/Layouts/AuthenticatedLayout"; -import { Head, router } from "@inertiajs/react"; +import { Head, router, usePage } from "@inertiajs/react"; +import { PageProps as GlobalPageProps } from "@/types/global"; import { debounce } from "lodash"; import Pagination from "@/Components/shared/Pagination"; import { getBreadcrumbs } from "@/utils/breadcrumb"; @@ -57,6 +58,7 @@ interface PageProps { } export default function ProductManagement({ products, categories, units, filters }: PageProps) { + const { branding } = usePage().props; const [searchTerm, setSearchTerm] = useState(filters.search || ""); const [typeFilter, setTypeFilter] = useState(filters.category_id || "all"); const [perPage, setPerPage] = useState(filters.per_page || "10"); @@ -182,7 +184,7 @@ export default function ProductManagement({ products, categories, units, filters 商品資料管理 -

管理小小冰室原物料與成品資料

+

管理 {branding?.short_name || 'Star'} 原物料與成品資料

{/* Toolbar */} diff --git a/resources/js/Pages/Warehouse/Index.tsx b/resources/js/Pages/Warehouse/Index.tsx index 42a4e4b..763e522 100644 --- a/resources/js/Pages/Warehouse/Index.tsx +++ b/resources/js/Pages/Warehouse/Index.tsx @@ -225,7 +225,7 @@ export default function WarehouseIndex({ warehouses, totals, filters }: PageProp key={warehouse.id} warehouse={warehouse} stats={{ - totalQuantity: warehouse.total_quantity || 0, + totalQuantity: warehouse.book_stock || 0, lowStockCount: warehouse.low_stock_count || 0, replenishmentNeeded: warehouse.low_stock_count || 0 }} diff --git a/resources/views/app.blade.php b/resources/views/app.blade.php index 163bc6c..333343c 100644 --- a/resources/views/app.blade.php +++ b/resources/views/app.blade.php @@ -4,7 +4,7 @@ - {{ config('app.name', 'Laravel') }} + {{ $appName ?? config('app.name', 'Star ERP') }}