REFACTOR data service
This commit is contained in:
@@ -58,6 +58,16 @@ interface RegisterForm {
|
||||
paymentCompleted: boolean;
|
||||
}
|
||||
|
||||
interface RegisterFormErrors {
|
||||
fullName?: string;
|
||||
email?: string;
|
||||
confirmEmail?: string;
|
||||
password?: string;
|
||||
confirmPassword?: string;
|
||||
acceptTerms?: string;
|
||||
paymentCompleted?: string;
|
||||
}
|
||||
|
||||
const RegisterPage: React.FC<RegisterPageProps> = ({ onLogin, onNavigateToLogin }) => {
|
||||
const { register, isLoading } = useAuth();
|
||||
|
||||
@@ -73,7 +83,7 @@ const RegisterPage: React.FC<RegisterPageProps> = ({ onLogin, onNavigateToLogin
|
||||
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
|
||||
const [errors, setErrors] = useState<Partial<RegisterForm>>({});
|
||||
const [errors, setErrors] = useState<RegisterFormErrors>({});
|
||||
const [passwordStrength, setPasswordStrength] = useState<{
|
||||
score: number;
|
||||
checks: { [key: string]: boolean };
|
||||
@@ -246,7 +256,7 @@ const RegisterPage: React.FC<RegisterPageProps> = ({ onLogin, onNavigateToLogin
|
||||
e.preventDefault();
|
||||
|
||||
// Validate form but exclude payment requirement for first step
|
||||
const newErrors: Partial<RegisterForm> = {};
|
||||
const newErrors: RegisterFormErrors = {};
|
||||
|
||||
if (!formData.fullName.trim()) {
|
||||
newErrors.fullName = 'El nombre completo es obligatorio';
|
||||
@@ -346,7 +356,7 @@ const RegisterPage: React.FC<RegisterPageProps> = ({ onLogin, onNavigateToLogin
|
||||
}));
|
||||
|
||||
// Clear error when user starts typing
|
||||
if (errors[name as keyof RegisterForm]) {
|
||||
if (errors[name as keyof RegisterFormErrors]) {
|
||||
setErrors(prev => ({
|
||||
...prev,
|
||||
[name]: undefined
|
||||
|
||||
@@ -219,9 +219,6 @@ const DashboardPage: React.FC<DashboardPageProps> = ({
|
||||
onUpdateStatus={(itemId: string, status: any) => {
|
||||
console.log('Update status:', itemId, status);
|
||||
}}
|
||||
onViewDetails={() => {
|
||||
onNavigateToProduction?.();
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* Quick Overview - Supporting Information */}
|
||||
|
||||
@@ -7,7 +7,7 @@ import SimplifiedTrainingProgress from '../../components/SimplifiedTrainingProgr
|
||||
import {
|
||||
useTenant,
|
||||
useTraining,
|
||||
useData,
|
||||
useSales,
|
||||
useTrainingWebSocket,
|
||||
useOnboarding,
|
||||
TenantCreate,
|
||||
@@ -75,7 +75,7 @@ const OnboardingPage: React.FC<OnboardingPageProps> = ({ user, onComplete }) =>
|
||||
const [trainingJobId, setTrainingJobId] = useState<string>('');
|
||||
const { createTenant, getUserTenants, isLoading: tenantLoading } = useTenant();
|
||||
const { startTrainingJob } = useTraining({ disablePolling: true });
|
||||
const { uploadSalesHistory, validateSalesData } = useData();
|
||||
const { uploadSalesHistory, validateSalesData } = useSales();
|
||||
|
||||
const steps = [
|
||||
{ id: 1, title: 'Datos de Panadería', icon: Store },
|
||||
@@ -315,7 +315,7 @@ const OnboardingPage: React.FC<OnboardingPageProps> = ({ user, onComplete }) =>
|
||||
const tenantData: TenantCreate = {
|
||||
name: bakeryData.name,
|
||||
address: bakeryData.address,
|
||||
business_type: "bakery",
|
||||
business_type: "individual",
|
||||
postal_code: "28010",
|
||||
phone: "+34655334455",
|
||||
coordinates: bakeryData.coordinates,
|
||||
|
||||
@@ -355,9 +355,9 @@ const OrdersPage: React.FC = () => {
|
||||
<Package className="mx-auto h-12 w-12 text-gray-400 mb-4" />
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-2">No hay pedidos</h3>
|
||||
<p className="text-gray-600 mb-4">
|
||||
{activeTab === 'all'
|
||||
{activeTab === 'orders'
|
||||
? 'Aún no has creado ningún pedido'
|
||||
: `No hay pedidos ${activeTab === 'pending' ? 'pendientes' : 'entregados'}`
|
||||
: 'No hay datos disponibles para esta sección'
|
||||
}
|
||||
</p>
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user