diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2025-09-20 02:27:54 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2025-09-20 02:27:54 +0000 |
| commit | 557cadbde033fc67edc2f916cc5bfc2aac25b867 (patch) | |
| tree | d1b8fac281e9d50c9a08e8d157e78c07714bca6b /app/lib/camera/component/dispatchCamera.tsx | |
| parent | 84d3b0070c5460f325a0189e4d50a6f74053bec1 (diff) | |
| parent | 5c3d6cfd6f68b6eb7192aba47463bd0541bfbf48 (diff) | |
Merged in add_role (pull request #1)
Add role
Diffstat (limited to 'app/lib/camera/component/dispatchCamera.tsx')
| -rw-r--r-- | app/lib/camera/component/dispatchCamera.tsx | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/app/lib/camera/component/dispatchCamera.tsx b/app/lib/camera/component/dispatchCamera.tsx new file mode 100644 index 0000000..2591413 --- /dev/null +++ b/app/lib/camera/component/dispatchCamera.tsx @@ -0,0 +1,43 @@ +import React from "react"; +import useCameraStore from "../hooks/useCameraStore"; +import { IconButton } from "@mui/material"; +import { LocalShipping } from "@mui/icons-material"; + +const DispatchCamera: React.FC = () => { + const { setImageDispatch } = useCameraStore(); + const handleCapture = (event: React.ChangeEvent<HTMLInputElement>) => { + const file = event.target.files?.[0]; + if (file) { + const reader = new FileReader(); + reader.onloadend = () => { + setImageDispatch(reader.result as string); + }; + reader.readAsDataURL(file); + } + }; + + return ( + <div className="px-4 py-8 items-center border-2 rounded-md shadow-sm w-[49%] text-center "> + <input + type="file" + accept="image/*" + onChange={handleCapture} + className="hidden" + id="dispatchCameraInput" + /> + <label htmlFor="dispatchCameraInput" className="text-gray-600"> + <IconButton + color="primary" + aria-label="upload picture" + component="span" + > + <LocalShipping fontSize="large" /> + </IconButton> + <br /> + Foto Dispatch + </label> + </div> + ); +}; + +export default DispatchCamera; |
