Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d59b36850 | |||
| f1d659b273 | |||
| ad49489377 | |||
| 386fc8cb0c |
@@ -125,6 +125,3 @@ REACT_APP_FAM_GAME_LINK='https://games.wrenchboard.com'
|
|||||||
|
|
||||||
# REACT APP CUSTOMTIMER
|
# REACT APP CUSTOMTIMER
|
||||||
REACT_APP_CUSTOMTIMER=90
|
REACT_APP_CUSTOMTIMER=90
|
||||||
|
|
||||||
# MEDIA_SERVER_URL
|
|
||||||
MEDIA_SERVER_URL=''
|
|
||||||
@@ -93,6 +93,3 @@ REACT_APP_FAM_GAME_LINK='https://games.wrenchboard.com'
|
|||||||
|
|
||||||
# REACT APP CUSTOMTIMER
|
# REACT APP CUSTOMTIMER
|
||||||
REACT_APP_CUSTOMTIMER=90
|
REACT_APP_CUSTOMTIMER=90
|
||||||
|
|
||||||
# MEDIA_SERVER_URL
|
|
||||||
MEDIA_SERVER_URL=''
|
|
||||||
@@ -99,6 +99,3 @@ REACT_APP_FAM_GAME_LINK='https://games.wrenchboard.com'
|
|||||||
|
|
||||||
# REACT APP CUSTOMTIMER
|
# REACT APP CUSTOMTIMER
|
||||||
REACT_APP_CUSTOMTIMER=90
|
REACT_APP_CUSTOMTIMER=90
|
||||||
|
|
||||||
# MEDIA_SERVER_URL
|
|
||||||
MEDIA_SERVER_URL=''
|
|
||||||
@@ -164,7 +164,7 @@ export default function AssignPrevNewTask({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* ATTACHMENT SECTION*/}
|
{/* ATTACHMENT SECTION*/}
|
||||||
<div className="w-full max-h-32">
|
<div className="w-full max-h-28">
|
||||||
<AttachFile data={activeTask.data} />
|
<AttachFile data={activeTask.data} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
import React, { useRef, useState } from 'react'
|
import React, { useEffect, useRef, useState } from 'react'
|
||||||
import LoadingSpinner from '../Spinners/LoadingSpinner'
|
import LoadingSpinner from '../Spinners/LoadingSpinner'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
|
import usersService from '../../services/UsersService'
|
||||||
|
|
||||||
export default function AttachFile({data}) {
|
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 [requestStatus, setRequestStatus] = useState({loading: false, status:false, message:''})
|
||||||
|
|
||||||
const inputFile = useRef()
|
const inputFile = useRef()
|
||||||
@@ -13,7 +20,7 @@ export default function AttachFile({data}) {
|
|||||||
file: event.target.files[0],
|
file: event.target.files[0],
|
||||||
job_uid: data?.job_uid,
|
job_uid: data?.job_uid,
|
||||||
uid: localStorage.getItem("uid"),
|
uid: localStorage.getItem("uid"),
|
||||||
member_id: localStorage.getItem("member_id"),
|
// member_id: localStorage.getItem("member_id"),
|
||||||
sessionid: localStorage.getItem("session_token"),
|
sessionid: localStorage.getItem("session_token"),
|
||||||
};
|
};
|
||||||
setRequestStatus({loading: true, status:false, message:''})
|
setRequestStatus({loading: true, status:false, message:''})
|
||||||
@@ -29,51 +36,81 @@ export default function AttachFile({data}) {
|
|||||||
formData.append(input, inputs[input]);
|
formData.append(input, inputs[input]);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('data', formData, inputs)
|
axios.post(`${process.env.REACT_APP_MEDIA_LINK}/upload/task`,formData).then(res => {
|
||||||
// axios.post(`${process.env.MEDIA_SERVER_URL}/upload/task`,formData).then(res => {
|
if(res.data.status < 1){
|
||||||
// if(res.data.status < 1){
|
inputFile.current.value = null
|
||||||
// inputFile.current.value = null
|
setRequestStatus({loading: false, status:false, message:'upload failed'})
|
||||||
// setRequestStatus({loading: false, status:false, message:'upload failed'})
|
setTimeout(()=>{
|
||||||
// setTimeout(()=>{
|
setRequestStatus({loading: false, status:false, message:''})
|
||||||
// setRequestStatus({loading: false, status:false, message:''})
|
}, 3000)
|
||||||
// }, 3000)
|
return
|
||||||
// return
|
}
|
||||||
// }
|
setRequestStatus({loading: false, status:true, message:'uploaded'})
|
||||||
// setRequestStatus({loading: false, status:true, message:'uploaded'})
|
inputFile.current.value = null
|
||||||
// inputFile.current.value = null
|
setReloadList(prev => !prev) // Triggers list of upload reload
|
||||||
// setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
// setRequestStatus({loading: false, status:false, message:''})
|
setRequestStatus({loading: false, status:false, message:''})
|
||||||
// }, 3000)
|
}, 3000)
|
||||||
// }).catch(err => {
|
}).catch(err => {
|
||||||
// inputFile.current.value = null
|
inputFile.current.value = null
|
||||||
// setRequestStatus({loading: false, status:false, message:'upload failed'})
|
setRequestStatus({loading: false, status:false, message:'upload failed'})
|
||||||
// setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
// setRequestStatus({loading: false, status:false, message:''})
|
setRequestStatus({loading: false, status:false, message:''})
|
||||||
// }, 3000)
|
}, 3000)
|
||||||
// return
|
return
|
||||||
// })
|
})
|
||||||
|
|
||||||
setTimeout(()=>{
|
|
||||||
setRequestStatus({loading: false, status:false, message:''})
|
|
||||||
}, 3000)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 (
|
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='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'>
|
<div className='w-full flex justify-between items-center gap-1'>
|
||||||
<p className='job-label job-label-flex'>
|
<div className='job-label job-label-flex'>
|
||||||
Files {
|
Files {
|
||||||
requestStatus.loading ?
|
requestStatus.loading ?
|
||||||
<LoadingSpinner size='6' />
|
<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>
|
</div>
|
||||||
<label htmlFor='file' className={`cursor-pointer job-label py-1 px-2 rounded-full border ${ requestStatus.loading && 'pointer-events-none'}`}>+ Add</label>
|
<label htmlFor='file' className={`cursor-pointer text-[12px] py-1 px-2 rounded-full border ${ requestStatus.loading && 'pointer-events-none'}`}>+ Add</label>
|
||||||
</div>
|
</div>
|
||||||
<div className='job-label w-full px-2 py-1 h-20 overflow-y-auto flex justify-center items-center'>
|
<div className='text-[12px] w-full px-2 py-1 h-20 overflow-y-auto flex flex-col gap-1 border'>
|
||||||
list shows here
|
{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>
|
</div>
|
||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
|
|||||||
@@ -423,17 +423,19 @@ const EditJobPopoutNew = ({
|
|||||||
<div className="w-full flex items-center justify-center gap-2 mb-2">
|
<div className="w-full flex items-center justify-center gap-2 mb-2">
|
||||||
{/* FOR TASK IMAGE */}
|
{/* FOR TASK IMAGE */}
|
||||||
<div className="w-1/3 relative flex flex-col max-h-[130px] min-h-[130px]">
|
<div className="w-1/3 relative flex flex-col max-h-[130px] min-h-[130px]">
|
||||||
<label
|
<div className="w-full flex gap-2">
|
||||||
className={`w-full job-label job-label-flex cursor-pointer ${uploadStatus.loading && 'pointer-events-none'}`}
|
<label
|
||||||
htmlFor="task_image"
|
className={`w-full job-label cursor-pointer ${uploadStatus.loading && 'pointer-events-none'}`}
|
||||||
>
|
htmlFor="task_image"
|
||||||
Banner
|
>
|
||||||
|
Banner
|
||||||
|
</label>
|
||||||
{uploadStatus.loading ?
|
{uploadStatus.loading ?
|
||||||
<LoadingSpinner size='6' />
|
<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
|
<input
|
||||||
id="task_image"
|
id="task_image"
|
||||||
className="hidden"
|
className="hidden"
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ export const apiConst = {
|
|||||||
WRENCH_FILE_FAMILY: 400,
|
WRENCH_FILE_FAMILY: 400,
|
||||||
WRENCH_FILE_FAMILYBANNER: 410,
|
WRENCH_FILE_FAMILYBANNER: 410,
|
||||||
WRENCH_FILE_JOB : 500,
|
WRENCH_FILE_JOB : 500,
|
||||||
|
JOB_MANAGER_FILES: 13012,
|
||||||
WRENCHBOARD_BKO_START: 10000,
|
WRENCHBOARD_BKO_START: 10000,
|
||||||
WRENCHBOARD_BKO_LOGIN: 10010,
|
WRENCHBOARD_BKO_LOGIN: 10010,
|
||||||
WRENCHBOARD_BKO_CREATEUSER: 10015,
|
WRENCHBOARD_BKO_CREATEUSER: 10015,
|
||||||
|
|||||||
@@ -1356,6 +1356,18 @@ class usersService {
|
|||||||
return this.postAuxEnd("/assignmediatask", postData);
|
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(username)
|
||||||
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)
|
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)
|
||||||
|
|||||||
Reference in New Issue
Block a user