fix: selfpayMode state vars + monolith.sh TPV port + closures report

- Add missing selfpayMode/closePin state vars in admin POS page
- Add selfpayMode/closeSessionRequiresPin/closeSessionPin to PosTerminal interface
- Fix ClosedSession type in reporting/closures to match cash-close endpoint
- Add smtpReportEmail to admin StoreSettings interface
- monolith.sh: add TPV service (port 3002), reorder ports:
  API 3000, ADMIN 3001, TPV 3002, FRONTEND 3003, STOREFRONT 3004
- Add apps/pos to install_dependencies in monolith.sh
This commit is contained in:
chattie
2026-08-23 09:41:21 +02:00
parent 57c1781789
commit 725a02527a
4 changed files with 43 additions and 16 deletions

View File

@@ -19,6 +19,9 @@ interface PosTerminal {
touchNavigationEnabled?: boolean;
quickProductVariantIds?: Array<string | null>;
lineDiscountsEnabled?: boolean;
selfpayMode?: boolean;
closeSessionRequiresPin?: boolean;
closeSessionPin?: string;
};
}
interface CatalogOption {
@@ -94,6 +97,12 @@ export default function PosAdminPage() {
);
const [savingTouch, setSavingTouch] = useState(false);
const [touchMessage, setTouchMessage] = useState('');
// F-203: cash close security settings
const [selfpayMode, setSelfpayMode] = useState(false);
const [closePinRequired, setClosePinRequired] = useState(false);
const [closePinValue, setClosePinValue] = useState('');
const [savingSecurity, setSavingSecurity] = useState(false);
const [securityMessage, setSecurityMessage] = useState('');
const [paymentMethods, setPaymentMethods] = useState<PaymentMethod[]>([]);
const [cashiers, setCashiers] = useState<PosCashier[]>([]);
const [newCashier, setNewCashier] = useState({ email: '', password: '' });

View File

@@ -3,6 +3,16 @@
import { useCallback, useEffect, useState } from 'react';
import { api } from '@/lib/api-client';
interface SalesSummary {
totalCount: number;
completedCount: number;
completedTotalCents: number;
pendingCount: number;
refundedCount: number;
refundedTotalCents: number;
byState: Record<string, { count: number; totalCents: number }>;
}
interface ClosedSession {
id: string;
openedAt: string;
@@ -13,12 +23,9 @@ interface ClosedSession {
closingCashCents: number | null;
actualCashCents: number | null;
differenceCents: number | null;
salesCount: number;
salesTotalCents: number;
salesByState: Record<string, { count: number; totalCents: number }>;
sales: SalesSummary;
paymentsByMethod: Array<{ methodCode: string; methodName: string; totalCents: number; count: number }>;
itemsSold: number;
uniqueProductsSold: number;
items: { soldCount: number; uniqueProducts: number };
}
function fmt(cents: number): string {
@@ -240,11 +247,11 @@ export default function ReportingClosuresPage() {
))}
<div>
<p className="text-xs text-gray-500">Artículos vendidos</p>
<p className="text-lg font-bold text-gray-900">{report.itemsSold}</p>
<p className="text-lg font-bold text-gray-900">{report.items.soldCount}</p>
</div>
<div>
<p className="text-xs text-gray-500">Productos únicos</p>
<p className="text-lg font-bold text-gray-900">{report.uniqueProductsSold}</p>
<p className="text-lg font-bold text-gray-900">{report.items.uniqueProducts}</p>
</div>
</div>
</div>

View File

@@ -384,6 +384,7 @@ export interface StoreSettings {
smtpPass: string;
smtpPassConfigured?: boolean;
smtpFrom: string;
smtpReportEmail: string;
couriers?: string[];
}