feat: add tiktok and shopee order IDs to transaction model and UI components
This commit is contained in:
parent
74c374e126
commit
9e60a1cf39
@ -41,7 +41,7 @@ public function __construct(
|
|||||||
public function paginated(int $perPage = 25, string $search = '', string $sort = 'created_at', string $direction = 'desc', array $filters = []): LengthAwarePaginator
|
public function paginated(int $perPage = 25, string $search = '', string $sort = 'created_at', string $direction = 'desc', array $filters = []): LengthAwarePaginator
|
||||||
{
|
{
|
||||||
$paginator = Order::query()
|
$paginator = Order::query()
|
||||||
->select(['id', 'created_by_id', 'customer_id', 'marketing_id', 'order_number', 'channel', 'price_type', 'status', 'payment_type', 'subtotal', 'discount', 'nego_price', 'total_amount', 'cogs', 'notes', 'created_at'])
|
->select(['id', 'created_by_id', 'customer_id', 'marketing_id', 'order_number', 'channel', 'price_type', 'status', 'payment_type', 'tiktok_order_id', 'shopee_order_id', 'subtotal', 'discount', 'nego_price', 'total_amount', 'cogs', 'notes', 'created_at'])
|
||||||
->with([
|
->with([
|
||||||
'createdBy:id',
|
'createdBy:id',
|
||||||
'createdBy.userProfile:id,user_id,full_name',
|
'createdBy.userProfile:id,user_id,full_name',
|
||||||
|
|||||||
@ -40,6 +40,8 @@ export type Transaction = {
|
|||||||
payment_type_label: string;
|
payment_type_label: string;
|
||||||
channel_label: string;
|
channel_label: string;
|
||||||
price_type_label: string;
|
price_type_label: string;
|
||||||
|
tiktok_order_id: string | null;
|
||||||
|
shopee_order_id: string | null;
|
||||||
profit: number;
|
profit: number;
|
||||||
cogs: number;
|
cogs: number;
|
||||||
subtotal: number;
|
subtotal: number;
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import {
|
|||||||
ComboboxItem,
|
ComboboxItem,
|
||||||
ComboboxList,
|
ComboboxList,
|
||||||
} from '@/components/ui/combobox';
|
} from '@/components/ui/combobox';
|
||||||
|
import { FieldDescription } from '@/components/ui/field';
|
||||||
import { Label } from '@/components/ui/label';
|
import { Label } from '@/components/ui/label';
|
||||||
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
|
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
|
||||||
import {
|
import {
|
||||||
@ -38,7 +39,6 @@ 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 transactionIndex, update } from '@/routes/admin/manage/transactions';
|
import { index as transactionIndex, update } from '@/routes/admin/manage/transactions';
|
||||||
import { FieldDescription } from '@base-ui/react';
|
|
||||||
import { Form, Head, Link } 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';
|
||||||
|
|||||||
@ -51,7 +51,7 @@ export function TransactionCardRow({
|
|||||||
);
|
);
|
||||||
const statusBadgeClass =
|
const statusBadgeClass =
|
||||||
STATUS_BADGE_CLASSES[transaction.status] ?? STATUS_BADGE_CLASSES.pending;
|
STATUS_BADGE_CLASSES[transaction.status] ?? STATUS_BADGE_CLASSES.pending;
|
||||||
|
console.log('transaction', transaction);
|
||||||
return (
|
return (
|
||||||
<Card className="overflow-hidden">
|
<Card className="overflow-hidden">
|
||||||
<CardContent className="p-0">
|
<CardContent className="p-0">
|
||||||
@ -84,6 +84,11 @@ export function TransactionCardRow({
|
|||||||
<Badge variant="outline">
|
<Badge variant="outline">
|
||||||
{transaction.payment_type_label}
|
{transaction.payment_type_label}
|
||||||
</Badge>
|
</Badge>
|
||||||
|
{transaction.tiktok_order_id || transaction.shopee_order_id ? (
|
||||||
|
<Badge variant="outline">
|
||||||
|
{transaction.tiktok_order_id || transaction.shopee_order_id}
|
||||||
|
</Badge>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mt-1 text-xs text-muted-foreground">
|
<div className="mt-1 text-xs text-muted-foreground">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user