diff --git a/.env b/.env
index 6931de2..330d22f 100644
--- a/.env
+++ b/.env
@@ -45,6 +45,9 @@ REACT_APP_FACEBOOK_CLIENT_ID=390204307987009
REACT_APP_FACEBOOK_CLIENT_SECRET=19f778e312f2ab96d147bacb612910c2
REACT_APP_FACEBOOK_CLIENT_SCOPE="email, public_profile"
+REACT_APP_MAX_FILE_SIZE=1000000
+REACT_APP_TOTAL_NUM_FILE=4
+
#apigate.lotus.g1.wrenchboard.com:76.209.103.227
#apigate.orion.g1.wrenchboard.com:76.209.103.227
diff --git a/.env.development b/.env.development
index 7783b2d..288f294 100644
--- a/.env.development
+++ b/.env.development
@@ -37,4 +37,7 @@ REACT_APP_ITEM_PER_PAGE=5
REACT_APP_GOOGLE_CLIENT_ID=817021856543-ad9nsjgdpsu2s2jrl63j3ihrv7lbf6ma.apps.googleusercontent.com
REACT_APP_GOOGLE_CLIENT_SECRET=aozK_2G8UjaCmLgPPkv9abIm
REACT_APP_GOOGLE_CLIENT_SCOPE="https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"
-REACT_APP_GOOGLE_REDIRECT_URL=http://localhost:9082/login/auth/
\ No newline at end of file
+REACT_APP_GOOGLE_REDIRECT_URL=http://localhost:9082/login/auth/
+
+REACT_APP_MAX_FILE_SIZE=1000000
+REACT_APP_TOTAL_NUM_FILE=4
\ No newline at end of file
diff --git a/.env.production b/.env.production
index 94fbf21..d5d045f 100644
--- a/.env.production
+++ b/.env.production
@@ -37,4 +37,10 @@ REACT_APP_ITEM_PER_PAGE=5
REACT_APP_GOOGLE_CLIENT_ID=817021856543-ad9nsjgdpsu2s2jrl63j3ihrv7lbf6ma.apps.googleusercontent.com
REACT_APP_GOOGLE_CLIENT_SECRET=aozK_2G8UjaCmLgPPkv9abIm
REACT_APP_GOOGLE_CLIENT_SCOPE="https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"
-REACT_APP_GOOGLE_REDIRECT_URL=https://users.wrenchboard.com/login/auth/
\ No newline at end of file
+REACT_APP_GOOGLE_REDIRECT_URL=https://users.wrenchboard.com/login/auth/
+
+DISABLE_ESLINT_PLUGIN=true
+
+REACT_APP_MAX_FILE_SIZE=1000000
+REACT_APP_TOTAL_NUM_FILE=4
+
diff --git a/src/components/MyActiveJobs/ActiveJobMessage.jsx b/src/components/MyActiveJobs/ActiveJobMessage.jsx
index 9aedbfb..c73ec45 100644
--- a/src/components/MyActiveJobs/ActiveJobMessage.jsx
+++ b/src/components/MyActiveJobs/ActiveJobMessage.jsx
@@ -48,7 +48,7 @@ export default function ActiveJobMessage({ activeJobMesList }) {
:
- | No Purchase History Found! |
+ No Message Found! |
}
diff --git a/src/components/MyActiveJobs/ActiveJobs.jsx b/src/components/MyActiveJobs/ActiveJobs.jsx
index 5c7d710..e0a493f 100644
--- a/src/components/MyActiveJobs/ActiveJobs.jsx
+++ b/src/components/MyActiveJobs/ActiveJobs.jsx
@@ -15,6 +15,10 @@ function ActiveJobs(props) {
let [messageToSend, setMessageToSend] = useState('') // State to hold the value of message to be sent
+ let [filesToSend, setFilesToSend] = useState([]) // State to hold the value of files to be sent
+
+ let [tab, setTab] = useState('message')
+
let [requestStatus, setRequestStatus] = useState({loading: false, status: false, message: ''})
// FUNCTION TO HANDLE MESSAGE CHANGE
@@ -22,6 +26,43 @@ function ActiveJobs(props) {
setMessageToSend(value)
}
+ // FUNCTION TO HANDLE FILE UPlOAD CHANGE
+ const handleFileChange = ({target:{files}}) => {
+ setRequestStatus({loading: false, status: false, message: ''}) // State to determine error state
+ if(files[0].size > Number(process.env.REACT_APP_MAX_FILE_SIZE)){
+ setRequestStatus({loading: false, status: false, message: 'File must be <= 1mb'})
+ setTimeout(()=>{
+ setRequestStatus({loading: false, status: false, message: ''})
+ }, 5000)
+ return
+ }
+ if(filesToSend.length >= Number(process.env.REACT_APP_TOTAL_NUM_FILE)){
+ setRequestStatus({loading: false, status: false, message: `Total number of attachment is ${Number(process.env.REACT_APP_TOTAL_NUM_FILE)}`})
+ setTimeout(()=>{
+ setRequestStatus({loading: false, status: false, message: ''})
+ }, 5000)
+ return
+ }
+ // INCLUDE FILE IF NO ERROR
+ setFilesToSend(prev => ([...prev, files[0]]))
+ }
+
+ // FUNCTION TO CLEAR ALL TYPED MESSAGE OR FILES
+ const handleClearAll = ({target:{name}}) => {
+ if(tab == 'message'){
+ setMessageToSend('')
+ }else if(tab=='files'){
+ setFilesToSend([])
+ }else{
+ return
+ }
+ }
+
+ // FUNCTION TO REMOVE AND IMAGE
+ const handleRemoveImage = (imageToDelete) => {
+ setFilesToSend(prev => prev.filter(item => item.name != imageToDelete.name))
+ }
+
// FUNCTION TO SEND TASK MESSAGE
const sendTaskMessage = () => {
let reqData={message: messageToSend, msg_type: 'TEXT', contract:props.details.contract}
@@ -52,11 +93,10 @@ function ActiveJobs(props) {
return (
-
-
-
- {/* back btn and title */}
-
+
+ {/* job title */}
+
+
-
+
{props.details?.title && props.details.title}
- {/* END of back btn and title */}
-
-
-
+
+
+
{props.details?.contract && props.details.contract}
-
- Description:
- {props.details?.description && props.details.description}
-
-
Delivery Detail
-
-
- Due:
- {props.details?.delivery_date &&
- props.details.delivery_date.split(" ")[0]}
-
-
- {props.details?.delivery_date &&
- props.details.delivery_date.split(" ")[1]}
-
-
- {props.details?.timeline_days && props.details.timeline_days} day(s)
-
-
-
-
-
+
{userDetails.firstname && userDetails.firstname}
+
+
+ Description:
+ {props.details?.description && props.details.description}
+
+ {/* end of job title */}
-
+ {/* job details */}
+
+
Delivery Detail
+
+
+ Due:
+ {props.details?.delivery_date &&
+ props.details.delivery_date.split(" ")[0]}
+
+
+ {props.details?.delivery_date &&
+ props.details.delivery_date.split(" ")[1]}
+
+
+ {props.details?.timeline_days && props.details.timeline_days} day(s)
+
+
+
+ {/* end of job details */}
+
+
+
+
-
Message(s)
-
+
Actions
+
+ Waiting for the completion message from the client before you can approve.
+
- {/* ERROR DISPLAY AND SUBMIT BUTTON */}
-
- {/* error or success display */}
- {requestStatus.message != "" &&
- (!requestStatus.status ? (
-
- {requestStatus.message}
+ {/* TEXTAREA SECTION */}
+
+
+ {/*
Message(s)
*/}
+
+
+
+
+ {tab == 'message' ?
+ (
+
+ )
+ :
+
+
+
+
+
+
+ {filesToSend.length > 0 &&
+ filesToSend.map((item, index)=> (
+
+ {item.name}
+
+
+ ))
+ }
+
- ) : (
- requestStatus.status && (
+ }
+
+
+ {/* ERROR DISPLAY AND SUBMIT BUTTON */}
+
+ {/* error or success display */}
+ {requestStatus.message != "" &&
+ (!requestStatus.status ? (
{requestStatus.message}
- )
- ))}
-
- {/* End of error or success display */}
+ ) : (
+ requestStatus.status && (
+
+ {requestStatus.message}
+
+ )
+ ))}
+
+ {/* End of error or success display */}
- {/* Buttons Sections */}
-
-
-
- {/* end of Buttons Sections */}
-
-
-
- {/* ACTION SECTION */}
-
-
-
Actions
-
-
- Waiting for the completion message from the client before you can approve.
-
+ {/* END OF TEXTAREA */}
-
-
-
Message
- {props.activeJobMesList.loading ?
-
- :
-
- }
-
+ {/* MESSAGE SECTION */}
+
+
Message
+ {props.activeJobMesList.loading ?
+
+ :
+
+ }
-
-
+ {/* END OF MESSAGE */}