Improve camera functionality and integrate it into the product forms

Refactors camera modal to use a custom hook for simplified photo capture logic across NewSaleForm and NewSaleFormMultiProduct components.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: c7151ec8-4e6b-4fcf-b628-65b094ac18fd
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/c7151ec8-4e6b-4fcf-b628-65b094ac18fd/URbRU29
This commit is contained in:
michaelschal committed 2025-07-19 13:02:06 +00:00
1 parent b3e003b3d6
commit 90e7193682
2 files changed
+61 -81

No files matched your search

+4 -4
View File
@@ -14,7 +14,7 @@ import { useSimpleCamera } from '@/hooks/useSimpleCamera';
import { apiRequest } from '@/lib/queryClient';
import { validateRequiredFields, validateEAN13, ARTICLE_CATEGORY_MAPPING, IDENTITY_TYPES, PAYMENT_METHODS } from '@/lib/validation';
import { Package, User, Users, Save, Calendar, BadgeCheck, Info, Camera, Upload, Trash2 } from 'lucide-react';
import SimpleCameraModal from '@/components/SimpleCameraModal';
import CameraModal from '@/components/CameraModal';
import type { PhotoType } from '@/types/sale';
interface Product {
@@ -245,7 +245,7 @@ export default function NewSaleForm() {
}
};
const handleTakePhoto = async () => {
const handleCapture = async () => {
if (!currentPhotoType) return;
try {
@@ -833,14 +833,14 @@ export default function NewSaleForm() {
</div>
{/* Camera Modal */}
<SimpleCameraModal
<CameraModal
isOpen={isCameraOpen}
photoType={currentPhotoType}
videoRef={videoRef}
canvasRef={canvasRef}
isCapturing={isCapturing}
onClose={stopCamera}
onCapture={handleTakePhoto}
onCapture={handleCapture}
/>
</div>
);