Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d59b36850 | |||
| f1d659b273 | |||
| ad49489377 | |||
| 386fc8cb0c |
@@ -124,7 +124,4 @@ REACT_APP_MEDIA_LINK='https://dev-media.wrenchboard.com'
|
||||
REACT_APP_FAM_GAME_LINK='https://games.wrenchboard.com'
|
||||
|
||||
# REACT APP CUSTOMTIMER
|
||||
REACT_APP_CUSTOMTIMER=90
|
||||
|
||||
# MEDIA_SERVER_URL
|
||||
MEDIA_SERVER_URL=''
|
||||
REACT_APP_CUSTOMTIMER=90
|
||||
+1
-4
@@ -92,7 +92,4 @@ REACT_APP_MEDIA_LINK='https://dev-media.wrenchboard.com'
|
||||
REACT_APP_FAM_GAME_LINK='https://games.wrenchboard.com'
|
||||
|
||||
# REACT APP CUSTOMTIMER
|
||||
REACT_APP_CUSTOMTIMER=90
|
||||
|
||||
# MEDIA_SERVER_URL
|
||||
MEDIA_SERVER_URL=''
|
||||
REACT_APP_CUSTOMTIMER=90
|
||||
+1
-4
@@ -98,7 +98,4 @@ REACT_APP_MEDIA_LINK='https://media.wrenchboard.com'
|
||||
REACT_APP_FAM_GAME_LINK='https://games.wrenchboard.com'
|
||||
|
||||
# REACT APP CUSTOMTIMER
|
||||
REACT_APP_CUSTOMTIMER=90
|
||||
|
||||
# MEDIA_SERVER_URL
|
||||
MEDIA_SERVER_URL=''
|
||||
REACT_APP_CUSTOMTIMER=90
|
||||
@@ -164,7 +164,7 @@ export default function AssignPrevNewTask({
|
||||
</div>
|
||||
|
||||
{/* ATTACHMENT SECTION*/}
|
||||
<div className="w-full max-h-32">
|
||||
<div className="w-full max-h-28">
|
||||
<AttachFile data={activeTask.data} />
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
import React, { useRef, useState } from 'react'
|
||||
import React, { useEffect, useRef, useState } from 'react'
|
||||
import LoadingSpinner from '../Spinners/LoadingSpinner'
|
||||
import axios from 'axios'
|
||||
|
||||
import usersService from '../../services/UsersService'
|
||||
|
||||
export default function AttachFile({data}) {
|
||||
|
||||
const apiCall = new usersService()
|
||||
|
||||
let [uploadedList, setUploadedList] = useState({loading: true, data:{}})
|
||||
let [reloadList, setReloadList] = useState(false) // Triggers list of upload reload
|
||||
|
||||
const [requestStatus, setRequestStatus] = useState({loading: false, status:false, message:''})
|
||||
|
||||
const inputFile = useRef()
|
||||
@@ -13,7 +20,7 @@ export default function AttachFile({data}) {
|
||||
file: event.target.files[0],
|
||||
job_uid: data?.job_uid,
|
||||
uid: localStorage.getItem("uid"),
|
||||
member_id: localStorage.getItem("member_id"),
|
||||
// member_id: localStorage.getItem("member_id"),
|
||||
sessionid: localStorage.getItem("session_token"),
|
||||
};
|
||||
setRequestStatus({loading: true, status:false, message:''})
|
||||
@@ -29,51 +36,81 @@ export default function AttachFile({data}) {
|
||||
formData.append(input, inputs[input]);
|
||||
}
|
||||
|
||||
console.log('data', formData, inputs)
|
||||
// axios.post(`${process.env.MEDIA_SERVER_URL}/upload/task`,formData).then(res => {
|
||||
// if(res.data.status < 1){
|
||||
// inputFile.current.value = null
|
||||
// setRequestStatus({loading: false, status:false, message:'upload failed'})
|
||||
// setTimeout(()=>{
|
||||
// setRequestStatus({loading: false, status:false, message:''})
|
||||
// }, 3000)
|
||||
// return
|
||||
// }
|
||||
// setRequestStatus({loading: false, status:true, message:'uploaded'})
|
||||
// inputFile.current.value = null
|
||||
// setTimeout(()=>{
|
||||
// setRequestStatus({loading: false, status:false, message:''})
|
||||
// }, 3000)
|
||||
// }).catch(err => {
|
||||
// inputFile.current.value = null
|
||||
// setRequestStatus({loading: false, status:false, message:'upload failed'})
|
||||
// setTimeout(()=>{
|
||||
// setRequestStatus({loading: false, status:false, message:''})
|
||||
// }, 3000)
|
||||
// return
|
||||
// })
|
||||
|
||||
setTimeout(()=>{
|
||||
setRequestStatus({loading: false, status:false, message:''})
|
||||
}, 3000)
|
||||
axios.post(`${process.env.REACT_APP_MEDIA_LINK}/upload/task`,formData).then(res => {
|
||||
if(res.data.status < 1){
|
||||
inputFile.current.value = null
|
||||
setRequestStatus({loading: false, status:false, message:'upload failed'})
|
||||
setTimeout(()=>{
|
||||
setRequestStatus({loading: false, status:false, message:''})
|
||||
}, 3000)
|
||||
return
|
||||
}
|
||||
setRequestStatus({loading: false, status:true, message:'uploaded'})
|
||||
inputFile.current.value = null
|
||||
setReloadList(prev => !prev) // Triggers list of upload reload
|
||||
setTimeout(()=>{
|
||||
setRequestStatus({loading: false, status:false, message:''})
|
||||
}, 3000)
|
||||
}).catch(err => {
|
||||
inputFile.current.value = null
|
||||
setRequestStatus({loading: false, status:false, message:'upload failed'})
|
||||
setTimeout(()=>{
|
||||
setRequestStatus({loading: false, status:false, message:''})
|
||||
}, 3000)
|
||||
return
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(()=>{
|
||||
apiCall.jobManagerFiles({job_uid:data?.job_uid}).then(res => {
|
||||
setUploadedList({loading: false, data:res.data})
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
setUploadedList({loading: false, data:{}})
|
||||
})
|
||||
},[data, reloadList])
|
||||
|
||||
return (
|
||||
<div className='w-full h-full flex flex-col justify-center items-center rounded-md border'>
|
||||
<div className='w-full h-full flex flex-col justify-center items-center rounded-md'>
|
||||
<div className='w-full flex flex-col items-start gap-1 overflow-hidden'>
|
||||
<div className='p-2 w-full flex justify-between items-center gap-1 border-b shadow-sm'>
|
||||
<p className='job-label job-label-flex'>
|
||||
<div className='w-full flex justify-between items-center gap-1'>
|
||||
<div className='job-label job-label-flex'>
|
||||
Files {
|
||||
requestStatus.loading ?
|
||||
<LoadingSpinner size='6' />
|
||||
:
|
||||
<p className={`text-[10px] ${requestStatus.status ? 'text-emerald-600' : 'text-red-500'}`}>{requestStatus.message}</p>
|
||||
<span className={`text-[10px] ${requestStatus.status ? 'text-emerald-600' : 'text-red-500'}`}>{requestStatus.message}</span>
|
||||
}
|
||||
</p>
|
||||
<label htmlFor='file' className={`cursor-pointer job-label py-1 px-2 rounded-full border ${ requestStatus.loading && 'pointer-events-none'}`}>+ Add</label>
|
||||
</div>
|
||||
<label htmlFor='file' className={`cursor-pointer text-[12px] py-1 px-2 rounded-full border ${ requestStatus.loading && 'pointer-events-none'}`}>+ Add</label>
|
||||
</div>
|
||||
<div className='job-label w-full px-2 py-1 h-20 overflow-y-auto flex justify-center items-center'>
|
||||
list shows here
|
||||
<div className='text-[12px] w-full px-2 py-1 h-20 overflow-y-auto flex flex-col gap-1 border'>
|
||||
{uploadedList.loading ?
|
||||
<div className='w-full h-full justify-center items-center'>
|
||||
<LoadingSpinner size='6' height='h-full' />
|
||||
</div>
|
||||
:
|
||||
Object.keys(uploadedList.data).length > 0 ?
|
||||
uploadedList.data.result_list.length > 0 ?
|
||||
uploadedList.data.result_list.map((item, index) => (
|
||||
<div className='flex justify-start gap-2'>
|
||||
<span>{index + 1}:</span>
|
||||
<a
|
||||
target='_blank'
|
||||
alt='download-link'
|
||||
key={item.file_uid}
|
||||
className=''
|
||||
href={`${uploadedList?.data?.session_image_server}/${localStorage.getItem("session_token")}/jobfile/${item.file_uid}`}
|
||||
>
|
||||
{item.originalname}
|
||||
</a>
|
||||
</div>
|
||||
))
|
||||
:
|
||||
<p className='text-sm'>No Uploaded files yet</p>
|
||||
:
|
||||
<></>
|
||||
}
|
||||
</div>
|
||||
<input
|
||||
type="file"
|
||||
|
||||
@@ -423,17 +423,19 @@ const EditJobPopoutNew = ({
|
||||
<div className="w-full flex items-center justify-center gap-2 mb-2">
|
||||
{/* FOR TASK IMAGE */}
|
||||
<div className="w-1/3 relative flex flex-col max-h-[130px] min-h-[130px]">
|
||||
<label
|
||||
className={`w-full job-label job-label-flex cursor-pointer ${uploadStatus.loading && 'pointer-events-none'}`}
|
||||
htmlFor="task_image"
|
||||
>
|
||||
Banner
|
||||
<div className="w-full flex gap-2">
|
||||
<label
|
||||
className={`w-full job-label cursor-pointer ${uploadStatus.loading && 'pointer-events-none'}`}
|
||||
htmlFor="task_image"
|
||||
>
|
||||
Banner
|
||||
</label>
|
||||
{uploadStatus.loading ?
|
||||
<LoadingSpinner size='6' />
|
||||
:
|
||||
<p className={`text-[10px] ${uploadStatus.status ? 'text-emerald-600' : 'text-red-500'}`}>{uploadStatus.message}</p>
|
||||
<span className={`text-[10px] ${uploadStatus.status ? 'text-emerald-600' : 'text-red-500'}`}>{uploadStatus.message}</span>
|
||||
}
|
||||
</label>
|
||||
</div>
|
||||
<input
|
||||
id="task_image"
|
||||
className="hidden"
|
||||
|
||||
@@ -44,6 +44,7 @@ export const apiConst = {
|
||||
WRENCH_FILE_FAMILY: 400,
|
||||
WRENCH_FILE_FAMILYBANNER: 410,
|
||||
WRENCH_FILE_JOB : 500,
|
||||
JOB_MANAGER_FILES: 13012,
|
||||
WRENCHBOARD_BKO_START: 10000,
|
||||
WRENCHBOARD_BKO_LOGIN: 10010,
|
||||
WRENCHBOARD_BKO_CREATEUSER: 10015,
|
||||
|
||||
@@ -1356,6 +1356,18 @@ class usersService {
|
||||
return this.postAuxEnd("/assignmediatask", postData);
|
||||
}
|
||||
|
||||
// API FUNCTION FOR LISTING JOB MANAGER FILES (TASK FILE UPLAOD)
|
||||
jobManagerFiles(reqData) {
|
||||
var postData = {
|
||||
member_uid: localStorage.getItem("uid"),
|
||||
member_id: localStorage.getItem("member_id"),
|
||||
sessionid: localStorage.getItem("session_token"),
|
||||
action: apiConst.JOB_MANAGER_FILES,
|
||||
...reqData
|
||||
};
|
||||
return this.postAuxEnd("/jobmanagerfiles", postData);
|
||||
}
|
||||
|
||||
/*
|
||||
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username)
|
||||
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)
|
||||
|
||||
Reference in New Issue
Block a user