refactor: replace anchor tags with Link components for improved navigation consistency

This commit is contained in:
Yoga Pangestu 2026-08-05 20:48:58 +07:00
parent 705f0d3efa
commit bd20162c13
31 changed files with 123 additions and 122 deletions

View File

@ -1,3 +1,4 @@
import { router } from '@inertiajs/react';
import { Bell, Check, Trash2 } from 'lucide-react'; import { Bell, Check, Trash2 } from 'lucide-react';
import { useCallback, useEffect, useRef, useState } from 'react'; import { useCallback, useEffect, useRef, useState } from 'react';
import { Badge } from '@/components/ui/badge'; import { Badge } from '@/components/ui/badge';
@ -189,15 +190,11 @@ export function NotificationBell() {
: 'opacity-60' : 'opacity-60'
}`} }`}
> >
<a <div
href={notification.url || '#'}
className="min-w-0 flex-1 cursor-pointer" className="min-w-0 flex-1 cursor-pointer"
onClick={(e) => { onClick={() => {
e.preventDefault();
if (notification.url) { if (notification.url) {
window.location.href = router.visit(notification.url);
notification.url;
} }
}} }}
> >
@ -225,7 +222,7 @@ export function NotificationBell() {
minute: '2-digit', minute: '2-digit',
})} })}
</span> </span>
</a> </div>
<div className="flex shrink-0 flex-col gap-1 pt-0.5"> <div className="flex shrink-0 flex-col gap-1 pt-0.5">
{!notification.is_read && ( {!notification.is_read && (
<Button <Button

View File

@ -1,4 +1,4 @@
import { Form, Head, router } from '@inertiajs/react'; import { Form, Head, Link, router } from '@inertiajs/react';
import { ArrowLeft } from 'lucide-react'; import { ArrowLeft } from 'lucide-react';
import { useState } from 'react'; import { useState } from 'react';
import { ConfirmDialog } from '@/components/confirm-dialog'; import { ConfirmDialog } from '@/components/confirm-dialog';
@ -139,10 +139,10 @@ export default function PayrollPeriodShow({ payrollPeriod }: Props) {
</p> </p>
</div> </div>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={payrollPeriodsIndex.url()}> <Link href={payrollPeriodsIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,4 +1,4 @@
import { Form, Head } from '@inertiajs/react'; import { Form, Head, Link } from '@inertiajs/react';
import { AlertCircle, ArrowLeft } from 'lucide-react'; import { AlertCircle, ArrowLeft } from 'lucide-react';
import { useState } from 'react'; import { useState } from 'react';
import { DatePicker } from '@/components/date-picker'; import { DatePicker } from '@/components/date-picker';
@ -55,10 +55,10 @@ export default function EmployeeCreate({ roles }: Props) {
</h2> </h2>
</div> </div>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={employeeIndex.url()}> <Link href={employeeIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,4 +1,4 @@
import { Form, Head } from '@inertiajs/react'; import { Form, Head, Link } from '@inertiajs/react';
import { ArrowLeft } from 'lucide-react'; import { ArrowLeft } from 'lucide-react';
import { useMemo, useState } from 'react'; import { useMemo, useState } from 'react';
import { DatePicker } from '@/components/date-picker'; import { DatePicker } from '@/components/date-picker';
@ -94,10 +94,10 @@ export default function EmployeeEdit({ employee, roles }: Props) {
</h2> </h2>
</div> </div>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={employeeIndex.url()}> <Link href={employeeIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,4 +1,4 @@
import { Head, router } from '@inertiajs/react'; import { Head, Link, router } from '@inertiajs/react';
import { Plus } from 'lucide-react'; import { Plus } from 'lucide-react';
import { useState } from 'react'; import { useState } from 'react';
import type { PaginationState } from '@/components/data-table'; import type { PaginationState } from '@/components/data-table';
@ -94,7 +94,7 @@ export default function EmployeeIndex({ employees, filters }: Props) {
const columns = createEmployeeColumns({ const columns = createEmployeeColumns({
handleEdit: (employee) => { handleEdit: (employee) => {
window.location.href = employeeEdit.url(employee.id); router.visit(employeeEdit.url(employee.id));
}, },
handleDeleteClick: (employee) => setDeleting(employee), handleDeleteClick: (employee) => setDeleting(employee),
handleResetPassword: (employee) => setResetPasswordTarget(employee), handleResetPassword: (employee) => setResetPasswordTarget(employee),
@ -184,10 +184,10 @@ export default function EmployeeIndex({ employees, filters }: Props) {
title="Pegawai" title="Pegawai"
actions={ actions={
<Button asChild> <Button asChild>
<a href={employeeCreate.url()}> <Link href={employeeCreate.url()}>
<Plus className="h-4 w-4" /> <Plus className="h-4 w-4" />
Tambah Tambah
</a> </Link>
</Button> </Button>
} }
/> />

View File

@ -19,7 +19,7 @@ import { formatNumber } from '@/lib/format';
import { getTemporaryUrl } from '@/lib/upload'; import { getTemporaryUrl } from '@/lib/upload';
import { formatCurrency } from '@/lib/utils'; import { formatCurrency } from '@/lib/utils';
import { index as cuttingIndex, store } from '@/routes/admin/manage/cuttings'; import { index as cuttingIndex, store } from '@/routes/admin/manage/cuttings';
import { Form, Head, usePage } from '@inertiajs/react'; import { Form, Head, Link, usePage } from '@inertiajs/react';
import { ArrowLeft, Check, Layers, Plus, ShoppingCart, Trash2 } from 'lucide-react'; import { ArrowLeft, Check, Layers, Plus, ShoppingCart, Trash2 } from 'lucide-react';
import { useCallback, useMemo, useRef, useState } from 'react'; import { useCallback, useMemo, useRef, useState } from 'react';
import type { CuttingCreateData } from './columns'; import type { CuttingCreateData } from './columns';
@ -290,10 +290,10 @@ export default function CuttingCreate({ data }: Props) {
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<h2 className="text-2xl font-semibold tracking-tight">Tambah Cutting</h2> <h2 className="text-2xl font-semibold tracking-tight">Tambah Cutting</h2>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={cuttingIndex.url()}> <Link href={cuttingIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -17,7 +17,7 @@ import { formatNumber } from '@/lib/format';
import { getTemporaryUrl } from '@/lib/upload'; import { getTemporaryUrl } from '@/lib/upload';
import { formatCurrency } from '@/lib/utils'; import { formatCurrency } from '@/lib/utils';
import { index as cuttingIndex, update } from '@/routes/admin/manage/cuttings'; import { index as cuttingIndex, update } from '@/routes/admin/manage/cuttings';
import { Form, Head } from '@inertiajs/react'; import { Form, Head, Link } from '@inertiajs/react';
import { ArrowLeft, Check, Layers, Plus, ShoppingCart, Trash2 } from 'lucide-react'; import { ArrowLeft, Check, Layers, Plus, ShoppingCart, Trash2 } from 'lucide-react';
import { useCallback, useMemo, useRef, useState } from 'react'; import { useCallback, useMemo, useRef, useState } from 'react';
import type { CuttingCreateData, CuttingForEdit } from './columns'; import type { CuttingCreateData, CuttingForEdit } from './columns';
@ -267,10 +267,10 @@ export default function CuttingEdit({ cutting, data }: Props) {
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<h2 className="text-2xl font-semibold tracking-tight">Edit Cutting</h2> <h2 className="text-2xl font-semibold tracking-tight">Edit Cutting</h2>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={cuttingIndex.url()}> <Link href={cuttingIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,4 +1,4 @@
import { Head, router } from '@inertiajs/react'; import { Head, Link, router } from '@inertiajs/react';
import { Plus } from 'lucide-react'; import { Plus } from 'lucide-react';
import { useState } from 'react'; import { useState } from 'react';
import { CardTable } from '@/components/card-table'; import { CardTable } from '@/components/card-table';
@ -67,10 +67,10 @@ export default function CuttingIndex({ cuttings }: Props) {
title="Cutting" title="Cutting"
actions={ actions={
<Button asChild> <Button asChild>
<a href={cuttingCreate.url()}> <Link href={cuttingCreate.url()}>
<Plus className="h-4 w-4" /> <Plus className="h-4 w-4" />
Tambah Tambah
</a> </Link>
</Button> </Button>
} }
/> />
@ -103,7 +103,7 @@ export default function CuttingIndex({ cuttings }: Props) {
isExpanded={isExpanded} isExpanded={isExpanded}
onToggleExpand={onToggleExpand} onToggleExpand={onToggleExpand}
onEdit={(c) => { onEdit={(c) => {
window.location.href = cuttingEdit.url(c.id); router.visit(cuttingEdit.url(c.id));
}} }}
onDelete={(c) => setDeleting(c)} onDelete={(c) => setDeleting(c)}
/> />

View File

@ -1,6 +1,6 @@
'use no memo'; 'use no memo';
import { Form, Head, usePage } from '@inertiajs/react'; import { Form, Head, Link, usePage } from '@inertiajs/react';
import { import {
ArrowLeft, ArrowLeft,
Check, Check,
@ -428,10 +428,10 @@ export default function PurchaseCreate({ data }: Props) {
Tambah Belanja Tambah Belanja
</h2> </h2>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={purchaseIndex.url()}> <Link href={purchaseIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,6 +1,6 @@
'use no memo'; 'use no memo';
import { Form, Head } from '@inertiajs/react'; import { Form, Head, Link } from '@inertiajs/react';
import { import {
ArrowLeft, ArrowLeft,
Check, Check,
@ -369,10 +369,10 @@ export default function PurchaseEdit({ purchase, data }: Props) {
Edit Belanja Edit Belanja
</h2> </h2>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={purchaseIndex.url()}> <Link href={purchaseIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,4 +1,4 @@
import { Head, router } from '@inertiajs/react'; import { Head, Link, router } from '@inertiajs/react';
import { Plus } from 'lucide-react'; import { Plus } from 'lucide-react';
import { useState } from 'react'; import { useState } from 'react';
import { CardTable } from '@/components/card-table'; import { CardTable } from '@/components/card-table';
@ -67,10 +67,10 @@ export default function PurchaseIndex({ purchases }: Props) {
title="Belanja" title="Belanja"
actions={ actions={
<Button asChild> <Button asChild>
<a href={purchaseCreate.url()}> <Link href={purchaseCreate.url()}>
<Plus className="h-4 w-4" /> <Plus className="h-4 w-4" />
Tambah Tambah
</a> </Link>
</Button> </Button>
} }
/> />
@ -103,7 +103,7 @@ export default function PurchaseIndex({ purchases }: Props) {
isExpanded={isExpanded} isExpanded={isExpanded}
onToggleExpand={onToggleExpand} onToggleExpand={onToggleExpand}
onEdit={(p) => { onEdit={(p) => {
window.location.href = purchaseEdit.url(p.id); router.visit(purchaseEdit.url(p.id));
}} }}
onDelete={(p) => setDeleting(p)} onDelete={(p) => setDeleting(p)}
/> />

View File

@ -1,6 +1,6 @@
'use no memo'; 'use no memo';
import { Form, Head, usePage } from '@inertiajs/react'; import { Form, Head, Link, usePage } from '@inertiajs/react';
import { ArrowLeft, Minus, Plus, ShoppingCart, Trash2 } from 'lucide-react'; import { ArrowLeft, Minus, Plus, ShoppingCart, Trash2 } from 'lucide-react';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { ConfirmDialog } from '@/components/confirm-dialog'; import { ConfirmDialog } from '@/components/confirm-dialog';
@ -219,10 +219,10 @@ return 0;
Tambah Restock Tambah Restock
</h2> </h2>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={restockIndex.url()}> <Link href={restockIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,6 +1,6 @@
'use no memo'; 'use no memo';
import { Form, Head } from '@inertiajs/react'; import { Form, Head, Link } from '@inertiajs/react';
import { ArrowLeft, Minus, Plus, ShoppingCart, Trash2 } from 'lucide-react'; import { ArrowLeft, Minus, Plus, ShoppingCart, Trash2 } from 'lucide-react';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { ConfirmDialog } from '@/components/confirm-dialog'; import { ConfirmDialog } from '@/components/confirm-dialog';
@ -193,10 +193,10 @@ return 0;
Edit Restock Edit Restock
</h2> </h2>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={restockIndex.url()}> <Link href={restockIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,4 +1,4 @@
import { Head, router } from '@inertiajs/react'; import { Head, Link, router } from '@inertiajs/react';
import { Plus } from 'lucide-react'; import { Plus } from 'lucide-react';
import { useState } from 'react'; import { useState } from 'react';
import { CardTable } from '@/components/card-table'; import { CardTable } from '@/components/card-table';
@ -67,10 +67,10 @@ export default function RestockIndex({ restocks }: Props) {
title="Restock" title="Restock"
actions={ actions={
<Button asChild> <Button asChild>
<a href={restockCreate.url()}> <Link href={restockCreate.url()}>
<Plus className="h-4 w-4" /> <Plus className="h-4 w-4" />
Tambah Tambah
</a> </Link>
</Button> </Button>
} }
/> />
@ -103,7 +103,7 @@ export default function RestockIndex({ restocks }: Props) {
isExpanded={isExpanded} isExpanded={isExpanded}
onToggleExpand={onToggleExpand} onToggleExpand={onToggleExpand}
onEdit={(r) => { onEdit={(r) => {
window.location.href = restockEdit.url(r.id); router.visit(restockEdit.url(r.id));
}} }}
onDelete={(r) => setDeleting(r)} onDelete={(r) => setDeleting(r)}
/> />

View File

@ -1,6 +1,6 @@
'use no memo'; 'use no memo';
import { Form, Head, usePage } from '@inertiajs/react'; import { Form, Head, Link, usePage } from '@inertiajs/react';
import { ArrowLeft, Minus, Plus, ShoppingCart, Trash2 } from 'lucide-react'; import { ArrowLeft, Minus, Plus, ShoppingCart, Trash2 } from 'lucide-react';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { ConfirmDialog } from '@/components/confirm-dialog'; import { ConfirmDialog } from '@/components/confirm-dialog';
@ -299,10 +299,10 @@ export default function TransactionCreate({ data }: Props) {
Tambah Transaksi Tambah Transaksi
</h2> </h2>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={transactionIndex.url()}> <Link href={transactionIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,6 +1,6 @@
'use no memo'; 'use no memo';
import { Form, Head } from '@inertiajs/react'; import { Form, Head, Link } from '@inertiajs/react';
import { ArrowLeft, Minus, Plus, ShoppingCart, Trash2 } from 'lucide-react'; import { ArrowLeft, Minus, Plus, ShoppingCart, Trash2 } from 'lucide-react';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { ConfirmDialog } from '@/components/confirm-dialog'; import { ConfirmDialog } from '@/components/confirm-dialog';
@ -276,10 +276,10 @@ export default function TransactionEdit({ transaction, data }: Props) {
Edit Transaksi Edit Transaksi
</h2> </h2>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={transactionIndex.url()}> <Link href={transactionIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,4 +1,4 @@
import { Head, router } from '@inertiajs/react'; import { Head, Link, router } from '@inertiajs/react';
import { Plus } from 'lucide-react'; import { Plus } from 'lucide-react';
import { useMemo, useState } from 'react'; import { useMemo, useState } from 'react';
import { CardTable } from '@/components/card-table'; import { CardTable } from '@/components/card-table';
@ -321,10 +321,10 @@ export default function TransactionIndex({
title="Transaksi" title="Transaksi"
actions={ actions={
<Button asChild> <Button asChild>
<a href={transactionCreate.url()}> <Link href={transactionCreate.url()}>
<Plus className="h-4 w-4" /> <Plus className="h-4 w-4" />
Tambah Tambah
</a> </Link>
</Button> </Button>
} }
/> />
@ -358,7 +358,7 @@ export default function TransactionIndex({
isExpanded={isExpanded} isExpanded={isExpanded}
onToggleExpand={onToggleExpand} onToggleExpand={onToggleExpand}
onEdit={(t) => { onEdit={(t) => {
window.location.href = transactionEdit.url(t.id); router.visit(transactionEdit.url(t.id));
}} }}
onDelete={(t) => setDeleting(t)} onDelete={(t) => setDeleting(t)}
/> />

View File

@ -1,4 +1,4 @@
import { Form, Head, usePage } from '@inertiajs/react'; import { Form, Head, Link, usePage } from '@inertiajs/react';
import { import {
ArrowLeft, ArrowLeft,
Copy, Copy,
@ -282,10 +282,10 @@ export default function ProductCreate({ categories }: Props) {
Tambah Produk Tambah Produk
</h2> </h2>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={productIndex.url()}> <Link href={productIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,4 +1,4 @@
import { Form, Head, usePage } from '@inertiajs/react'; import { Form, Head, Link, usePage } from '@inertiajs/react';
import { import {
ArrowLeft, ArrowLeft,
Copy, Copy,
@ -331,10 +331,10 @@ export default function ProductEdit({ product, categories }: Props) {
Edit Produk Edit Produk
</h2> </h2>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={productIndex.url()}> <Link href={productIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,6 +1,4 @@
import { Head, router } from '@inertiajs/react'; import { router } from '@inertiajs/react';
import { Plus } from 'lucide-react';
import { useMemo, useState } from 'react';
import { CardTable } from '@/components/card-table'; import { CardTable } from '@/components/card-table';
import { DeleteConfirmDialog } from '@/components/delete-confirm-dialog'; import { DeleteConfirmDialog } from '@/components/delete-confirm-dialog';
import { FilterPopover } from '@/components/filter-popover'; import { FilterPopover } from '@/components/filter-popover';
@ -26,14 +24,17 @@ import { useServerTable } from '@/hooks/use-server-table';
import { import {
destroy, destroy,
create as productCreate, create as productCreate,
index as productIndex,
edit as productEdit, edit as productEdit,
index as productIndex,
toggleStatus, toggleStatus,
} from '@/routes/admin/master/products'; } from '@/routes/admin/master/products';
import { import {
destroy as variantDestroy, destroy as variantDestroy,
edit as variantEdit, edit as variantEdit,
} from '@/routes/admin/master/products/variants'; } from '@/routes/admin/master/products/variants';
import { Head, router } from '@inertiajs/react';
import { Link, Plus } from 'lucide-react';
import { useMemo, useState } from 'react';
import type { Product, ProductVariant } from './columns'; import type { Product, ProductVariant } from './columns';
import { ProductCardRow } from './product-card'; import { ProductCardRow } from './product-card';
import { VariantSubRow } from './variant/sub-row'; import { VariantSubRow } from './variant/sub-row';
@ -249,10 +250,10 @@ export default function ProductIndex({ products, categories, filters }: Props) {
title="Produk" title="Produk"
actions={ actions={
<Button asChild> <Button asChild>
<a href={productCreate.url()}> <Link href={productCreate.url()}>
<Plus className="h-4 w-4" /> <Plus className="h-4 w-4" />
Tambah Tambah
</a> </Link>
</Button> </Button>
} }
/> />
@ -279,14 +280,14 @@ export default function ProductIndex({ products, categories, filters }: Props) {
product={item} product={item}
index={ index={
(pagination.current_page - 1) * (pagination.current_page - 1) *
pagination.per_page + pagination.per_page +
index + index +
1 1
} }
isExpanded={isExpanded} isExpanded={isExpanded}
onToggleExpand={onToggleExpand} onToggleExpand={onToggleExpand}
onEdit={(p) => { onEdit={(p) => {
window.location.href = productEdit.url(p.id); router.visit(productEdit.url(p.id));
}} }}
onDelete={(p) => setDeleting(p)} onDelete={(p) => setDeleting(p)}
toggleStatusUrl={(id) => toggleStatus.url(id)} toggleStatusUrl={(id) => toggleStatus.url(id)}
@ -296,10 +297,12 @@ export default function ProductIndex({ products, categories, filters }: Props) {
<VariantSubRow <VariantSubRow
product={product} product={product}
onEditVariant={(p, v) => { onEditVariant={(p, v) => {
window.location.href = variantEdit.url({ router.visit(
product: p.id, variantEdit.url({
variant: v.id, product: p.id,
}); variant: v.id,
}),
);
}} }}
onDeleteVariantClick={(p, v) => onDeleteVariantClick={(p, v) =>
setDeletingVariant({ product: p, variant: v }) setDeletingVariant({ product: p, variant: v })

View File

@ -1,4 +1,4 @@
import { Form, Head } from '@inertiajs/react'; import { Form, Head, Link } from '@inertiajs/react';
import { ArrowLeft } from 'lucide-react'; import { ArrowLeft } from 'lucide-react';
import { useState } from 'react'; import { useState } from 'react';
import { FileUploadMultiple } from '@/components/file-upload-multiple'; import { FileUploadMultiple } from '@/components/file-upload-multiple';
@ -87,10 +87,10 @@ export default function ProductVariantEdit({ variant }: Props) {
Edit Varian Edit Varian
</h2> </h2>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={productIndex.url()}> <Link href={productIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,4 +1,4 @@
import { Head } from '@inertiajs/react'; import { Head, Link } from '@inertiajs/react';
import { import {
ArrowDown, ArrowDown,
ArrowLeft, ArrowLeft,
@ -149,10 +149,10 @@ export default function StockMutationsPage({
</p> </p>
</div> </div>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={productIndex.url()}> <Link href={productIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,3 +1,4 @@
import { router } from '@inertiajs/react';
import { ArrowRightLeft, Pencil, ScrollText, Trash2 } from 'lucide-react'; import { ArrowRightLeft, Pencil, ScrollText, Trash2 } from 'lucide-react';
import { useState } from 'react'; import { useState } from 'react';
import { ImagePreviewButton } from '@/components/image-preview-button'; import { ImagePreviewButton } from '@/components/image-preview-button';
@ -133,11 +134,12 @@ export function VariantSubRow({
<ScrollText className="h-4 w-4" /> <ScrollText className="h-4 w-4" />
), ),
onClick: () => { onClick: () => {
window.location.href = router.visit(
stockMutations.url({ stockMutations.url({
product: product.id, product: product.id,
variant: variant.id, variant: variant.id,
}); }),
);
}, },
}, },
{ {

View File

@ -1,4 +1,4 @@
import { Form, Head, usePage } from '@inertiajs/react'; import { Form, Head, Link, usePage } from '@inertiajs/react';
import { import {
ArrowLeft, ArrowLeft,
Check, Check,
@ -193,10 +193,10 @@ export default function RawMaterialCreate() {
Tambah Bahan Baku Tambah Bahan Baku
</h2> </h2>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={rawMaterialIndex.url()}> <Link href={rawMaterialIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,4 +1,4 @@
import { Form, Head, usePage } from '@inertiajs/react'; import { Form, Head, Link, usePage } from '@inertiajs/react';
import { import {
ArrowLeft, ArrowLeft,
Check, Check,
@ -208,10 +208,10 @@ export default function RawMaterialEdit({ rawMaterial }: Props) {
Edit Bahan Baku Edit Bahan Baku
</h2> </h2>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={rawMaterialIndex.url()}> <Link href={rawMaterialIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,6 +1,4 @@
import { Head, router } from '@inertiajs/react'; import { router } from '@inertiajs/react';
import { Plus } from 'lucide-react';
import { useState } from 'react';
import { CardTable } from '@/components/card-table'; import { CardTable } from '@/components/card-table';
import { DeleteConfirmDialog } from '@/components/delete-confirm-dialog'; import { DeleteConfirmDialog } from '@/components/delete-confirm-dialog';
import { FilterPopover } from '@/components/filter-popover'; import { FilterPopover } from '@/components/filter-popover';
@ -18,14 +16,16 @@ import { useServerTable } from '@/hooks/use-server-table';
import { import {
destroy, destroy,
create as rawMaterialCreate, create as rawMaterialCreate,
index as rawMaterialIndex,
edit as rawMaterialEdit, edit as rawMaterialEdit,
index as rawMaterialIndex,
toggleStatus, toggleStatus,
} from '@/routes/admin/master/raw-materials'; } from '@/routes/admin/master/raw-materials';
import { import {
destroy as variantDestroy, destroy as variantDestroy
edit as variantEdit,
} from '@/routes/admin/master/raw-materials/variants'; } from '@/routes/admin/master/raw-materials/variants';
import { Head, Link, router } from '@inertiajs/react';
import { Plus } from 'lucide-react';
import { useState } from 'react';
import type { RawMaterial, RawMaterialVariant } from './columns'; import type { RawMaterial, RawMaterialVariant } from './columns';
import { RawMaterialCardRow } from './raw-material-card'; import { RawMaterialCardRow } from './raw-material-card';
import { RawMaterialVariantSubRow } from './variant/sub-row'; import { RawMaterialVariantSubRow } from './variant/sub-row';
@ -155,12 +155,12 @@ export default function RawMaterialIndex({ rawMaterials, filters }: Props) {
<PageHeader <PageHeader
title="Bahan Baku" title="Bahan Baku"
actions={ actions={
<Button asChild> <Link href={rawMaterialCreate.url()}>
<a href={rawMaterialCreate.url()}> <Button>
<Plus className="h-4 w-4" /> <Plus className="h-4 w-4" />
Tambah Tambah
</a> </Button>
</Button> </Link>
} }
/> />
@ -186,16 +186,14 @@ export default function RawMaterialIndex({ rawMaterials, filters }: Props) {
rawMaterial={item} rawMaterial={item}
index={ index={
(pagination.current_page - 1) * (pagination.current_page - 1) *
pagination.per_page + pagination.per_page +
index + index +
1 1
} }
isExpanded={isExpanded} isExpanded={isExpanded}
onToggleExpand={onToggleExpand} onToggleExpand={onToggleExpand}
onEdit={(rm) => { onEdit={(rm) => {
window.location.href = rawMaterialEdit.url( router.visit(rawMaterialEdit.url(rm.id));
rm.id,
);
}} }}
onDelete={(rm) => setDeleting(rm)} onDelete={(rm) => setDeleting(rm)}
toggleStatusUrl={(id) => toggleStatus.url(id)} toggleStatusUrl={(id) => toggleStatus.url(id)}

View File

@ -1,4 +1,4 @@
import { Form, Head } from '@inertiajs/react'; import { Form, Head, Link } from '@inertiajs/react';
import { ArrowLeft } from 'lucide-react'; import { ArrowLeft } from 'lucide-react';
import { useState } from 'react'; import { useState } from 'react';
import { FileUpload } from '@/components/file-upload'; import { FileUpload } from '@/components/file-upload';
@ -51,10 +51,10 @@ export default function RawMaterialVariantEdit({ variant }: Props) {
Edit Varian Edit Varian
</h2> </h2>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={rawMaterialIndex.url()}> <Link href={rawMaterialIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -108,12 +108,13 @@ export function RawMaterialVariantSubRow({
<Pencil className="h-4 w-4" /> <Pencil className="h-4 w-4" />
), ),
onClick: () => { onClick: () => {
window.location.href = router.visit(
variantEdit.url({ variantEdit.url({
rawMaterial: rawMaterial:
rawMaterial.id, rawMaterial.id,
variant: variant.id, variant: variant.id,
}); }),
);
}, },
}, },
{ {

View File

@ -1,4 +1,4 @@
import { Form, Head } from '@inertiajs/react'; import { Form, Head, Link } from '@inertiajs/react';
import { ArrowLeft } from 'lucide-react'; import { ArrowLeft } from 'lucide-react';
import InputError from '@/components/input-error'; import InputError from '@/components/input-error';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
@ -70,10 +70,10 @@ export default function RoleCreate({ permissions }: Props) {
</h2> </h2>
</div> </div>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={rolesIndex.url()}> <Link href={rolesIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,4 +1,4 @@
import { Form, Head } from '@inertiajs/react'; import { Form, Head, Link } from '@inertiajs/react';
import { ArrowLeft } from 'lucide-react'; import { ArrowLeft } from 'lucide-react';
import InputError from '@/components/input-error'; import InputError from '@/components/input-error';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
@ -82,10 +82,10 @@ export default function RoleEdit({ role, permissions }: Props) {
</h2> </h2>
</div> </div>
<Button asChild variant="outline"> <Button asChild variant="outline">
<a href={rolesIndex.url()}> <Link href={rolesIndex.url()}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
Kembali Kembali
</a> </Link>
</Button> </Button>
</div> </div>

View File

@ -1,4 +1,4 @@
import { Head, router } from '@inertiajs/react'; import { Head, Link, router } from '@inertiajs/react';
import { Plus } from 'lucide-react'; import { Plus } from 'lucide-react';
import { useState } from 'react'; import { useState } from 'react';
import type { PaginationState } from '@/components/data-table'; import type { PaginationState } from '@/components/data-table';
@ -58,7 +58,7 @@ export default function RoleIndex({ roles }: Props) {
const columns = createRoleColumns({ const columns = createRoleColumns({
handleEdit: (role) => { handleEdit: (role) => {
window.location.href = roleEdit.url(role.id); router.visit(roleEdit.url(role.id));
}, },
handleDeleteClick: (role) => setDeleting(role), handleDeleteClick: (role) => setDeleting(role),
}); });
@ -72,10 +72,10 @@ export default function RoleIndex({ roles }: Props) {
title="Role & Permission" title="Role & Permission"
actions={ actions={
<Button asChild> <Button asChild>
<a href={roleCreate.url()}> <Link href={roleCreate.url()}>
<Plus className="h-4 w-4" /> <Plus className="h-4 w-4" />
Tambah Tambah
</a> </Link>
</Button> </Button>
} }
/> />