Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 24f915ee55 | |||
| 5da67c4c06 | |||
| a21eaa40f2 | |||
| a00e40dbe9 | |||
| fa51914987 | |||
| c8d40c1630 | |||
| f673fe99ef | |||
| 8d5d0672cc | |||
| 09def50875 | |||
| d6920b320c | |||
| cbfaf1e073 | |||
| 3d59b36850 | |||
| f1d659b273 |
Binary file not shown.
|
After Width: | Height: | Size: 7.6 KiB |
@@ -4,7 +4,7 @@ import linkedInLogo from "../../../assets/images/Linkedin.png";
|
||||
import appleLogo from "../../../assets/images/apple-black.svg";
|
||||
import facebookLogo from "../../../assets/images/facebook.svg";
|
||||
import googleLogo from "../../../assets/images/google-logo.svg";
|
||||
import WrenchBoard from "../../../assets/images/wrenchboard-logo-text.png";
|
||||
import WrenchBoard from "../../../assets/images/wrenchboard-logo-text_new.png";
|
||||
import usersService from "../../../services/UsersService";
|
||||
import InputCom from "../../Helpers/Inputs/InputCom";
|
||||
import AuthLayout from "../AuthLayout2";
|
||||
|
||||
@@ -20,7 +20,7 @@ export default function ActiveJobMessage({ activeJobMesList }) {
|
||||
|
||||
return (
|
||||
<div className='flex flex-col justify-between'>
|
||||
<div className="w-full h-full min-h-[400px] max-h-[400px] overflow-y-auto">
|
||||
<div className="w-full h-full min-h-[250px] max-h-[300px] overflow-y-auto">
|
||||
<table className="wallet-activity w-full table-auto border-collapse text-left">
|
||||
<thead className='border-b-2'>
|
||||
<tr className='text-slate-600'>
|
||||
|
||||
@@ -13,6 +13,7 @@ import usersService from "../../services/UsersService";
|
||||
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||
import { SocketValues } from "../Contexts/SocketIOContext";
|
||||
import TabButton from "../customTabs/TabButton";
|
||||
import AttachFile from "../attachmentCom/AttachFile";
|
||||
|
||||
function ActiveJobs(props) {
|
||||
let {sendMessage, joinRoom} = SocketValues() // destructures 'SEND MESSAGE' and 'JOIN ROOM' FUNCTIONS FROM SOCKET
|
||||
@@ -539,6 +540,13 @@ function ActiveJobs(props) {
|
||||
|
||||
{/* MESSAGE SECTION */}
|
||||
<div className="w-full lg:w-1/2">
|
||||
<div className="mb-4">
|
||||
<AttachFile
|
||||
data={props.details}
|
||||
showOnData={true}
|
||||
fontSize={'text-lg'}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex justify-between items-center gap-5">
|
||||
<p className="w-full text-lg font-bold text-dark-gray dark:text-white tracking-wide flex items-center gap-2 justify-between">
|
||||
<span>Message</span>
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
import React, { useRef, useState } from 'react'
|
||||
import React, { useEffect, useRef, useState } from 'react'
|
||||
import LoadingSpinner from '../Spinners/LoadingSpinner'
|
||||
import axios from 'axios'
|
||||
|
||||
export default function AttachFile({data}) {
|
||||
import usersService from '../../services/UsersService'
|
||||
|
||||
export default function AttachFile({data='', fontSize='text-sm', showOnData=false}) {
|
||||
|
||||
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:''})
|
||||
|
||||
@@ -29,9 +36,8 @@ export default function AttachFile({data}) {
|
||||
formData.append(input, inputs[input]);
|
||||
}
|
||||
|
||||
console.log('data', formData, inputs)
|
||||
axios.post(`${process.env.REACT_APP_MEDIA_LINK}/upload/task`,formData).then(res => {
|
||||
if(res.data.status < 1){
|
||||
if(res.data.internal_return < 0){
|
||||
inputFile.current.value = null
|
||||
setRequestStatus({loading: false, status:false, message:'upload failed'})
|
||||
setTimeout(()=>{
|
||||
@@ -39,9 +45,9 @@ export default function AttachFile({data}) {
|
||||
}, 3000)
|
||||
return
|
||||
}
|
||||
// console.log('RESPONSE', res.data)
|
||||
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)
|
||||
@@ -55,31 +61,113 @@ export default function AttachFile({data}) {
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(()=>{
|
||||
apiCall.jobManagerFiles({job_uid:data?.job_uid || data?.origin_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'>
|
||||
<div className='w-full flex flex-col items-start gap-1 overflow-hidden'>
|
||||
<div className='w-full flex justify-between items-center gap-1'>
|
||||
<div className='job-label job-label-flex'>
|
||||
Files {
|
||||
requestStatus.loading ?
|
||||
<LoadingSpinner size='6' />
|
||||
:
|
||||
<span className={`text-[10px] ${requestStatus.status ? 'text-emerald-600' : 'text-red-500'}`}>{requestStatus.message}</span>
|
||||
}
|
||||
<>
|
||||
{!showOnData ?
|
||||
<div className='w-full h-full flex flex-col justify-center items-center'>
|
||||
<div className='w-full flex flex-col items-start gap-1 overflow-hidden'>
|
||||
<div className='w-full flex justify-between items-center gap-1'>
|
||||
<div className='job-label job-label-flex'>
|
||||
Files {
|
||||
requestStatus.loading ?
|
||||
<LoadingSpinner size='6' />
|
||||
:
|
||||
<span className={`text-[10px] ${requestStatus.status ? 'text-emerald-600' : 'text-red-500'}`}>{requestStatus.message}</span>
|
||||
}
|
||||
</div>
|
||||
<label htmlFor='file' className={`text-black bg-[#f8ffd4] cursor-pointer text-[12px] py-1 px-2 rounded-full border ${ requestStatus.loading && 'pointer-events-none'}`}>+ Add Files</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 className='w-full p-2 rounded-2xl bg-slate-100'>
|
||||
<div className='text-[12px] w-full h-20 overflow-y-auto flex flex-col gap-2'>
|
||||
{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) => {
|
||||
let fileNameExt = item.originalname.split('.')[item.originalname.split('.').length - 1]
|
||||
return(
|
||||
<div key={item.file_uid} className={`my-[6px] flex justify-start gap-2 ${fontSize}`}>
|
||||
<span>{index + 1}:</span>
|
||||
<a
|
||||
target='_blank'
|
||||
alt='download-link'
|
||||
className=''
|
||||
href={`${uploadedList?.data?.session_image_server}/${localStorage.getItem("session_token")}/jobfile/${item.file_uid}`}
|
||||
>
|
||||
{(item.originalname).toString().length > 30 ? (item.originalname).toString().slice(0, 26) + '..._.' + fileNameExt : (item.originalname).toString()}
|
||||
</a>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
:
|
||||
<p className='text-sm'>No Uploaded files yet</p>
|
||||
:
|
||||
<></>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<input
|
||||
type="file"
|
||||
id='file'
|
||||
ref={inputFile}
|
||||
className='hidden file:rounded-full job-label p-1'
|
||||
onChange={upload}
|
||||
/>
|
||||
</div>
|
||||
<div className='text-[12px] w-full px-2 py-1 h-20 overflow-y-auto flex justify-center items-center border'>
|
||||
list shows here
|
||||
</div>
|
||||
<input
|
||||
type="file"
|
||||
id='file'
|
||||
ref={inputFile}
|
||||
className='hidden file:rounded-full job-label p-1'
|
||||
onChange={upload}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
:showOnData && uploadedList?.data?.result_list?.length > 0 ?
|
||||
<div className='w-full h-full flex flex-col justify-center items-center'>
|
||||
<div className='w-full flex flex-col items-start gap-1 overflow-hidden'>
|
||||
<div className='w-full flex justify-between items-center gap-1'>
|
||||
<div className='job-label job-label-flex'>
|
||||
Files
|
||||
</div>
|
||||
</div>
|
||||
<div className='w-full p-2 rounded-2xl bg-slate-100'>
|
||||
<div className='text-[12px] w-full p-2 h-20 overflow-y-auto flex flex-col gap-2'>
|
||||
{uploadedList.data.result_list.map((item, index) => {
|
||||
let fileNameExt = item.originalname.split('.')[item.originalname.split('.').length - 1]
|
||||
return(
|
||||
<div key={item.file_uid} className={`my-[6px] flex justify-start gap-2 ${fontSize}`}>
|
||||
<span>{index + 1}:</span>
|
||||
<a
|
||||
target='_blank'
|
||||
alt='download-link'
|
||||
className=''
|
||||
href={`${uploadedList?.data?.session_image_server}/${localStorage.getItem("session_token")}/jobfile/${item.file_uid}`}
|
||||
>
|
||||
{(item.originalname).toString().length > 30 ? (item.originalname).toString().slice(0, 26) + '..._.' + fileNameExt : (item.originalname).toString()}
|
||||
</a>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<input
|
||||
type="file"
|
||||
id='file'
|
||||
ref={inputFile}
|
||||
className='hidden file:rounded-full job-label p-1'
|
||||
onChange={upload}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
:
|
||||
<></>
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import { tableReload } from "../../store/TableReloads";
|
||||
import { useDispatch } from "react-redux";
|
||||
|
||||
import { SocketValues } from "../Contexts/SocketIOContext";
|
||||
import AttachFile from "../attachmentCom/AttachFile";
|
||||
|
||||
const VideoElement = lazy(() => import("../VideoCom/VideoElement"));
|
||||
const ImageElement = lazy(() => import("../ImageCon/ImageElement"));
|
||||
@@ -206,11 +207,11 @@ function FamilyOfferJobPopout({ details, onClose, situation }) {
|
||||
</div>
|
||||
|
||||
{/* ACTION SECTION */}
|
||||
<div className="p-4 w-full md:w-2/5 h-full flex flex-col justify-between">
|
||||
<div className="p-4 w-full md:w-2/5 h-full flex flex-col gap-4 justify-between">
|
||||
{ details.job_type == 'TASK' ?
|
||||
<div className="image-wrapper w-full h-40 flex justify-center items-center">
|
||||
<Suspense fallback={<p className="w-full text-center">Loading...</p>}>
|
||||
<ImageElement src={details?.image} alt='banner' className='w-auto h-full' />
|
||||
<ImageElement src={details?.image} alt='banner' className='w-full h-auto' />
|
||||
</Suspense>
|
||||
</div>
|
||||
:
|
||||
@@ -222,6 +223,9 @@ function FamilyOfferJobPopout({ details, onClose, situation }) {
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div className="w-full">
|
||||
<AttachFile data={details} showOnData={true} />
|
||||
</div>
|
||||
<div className="my-3 md:flex md:justify-center">
|
||||
{requestStatus.loading && requestStatus.trigger == "offer" ? (
|
||||
<LoadingSpinner size={8} color="sky-blue" />
|
||||
|
||||
@@ -3,7 +3,7 @@ import React from 'react'
|
||||
function Detail({label, value, bg,}) {
|
||||
return (
|
||||
<>
|
||||
<label className='job-label w-full md:w-1/4'>{label}</label>
|
||||
<label className='job-label w-full md:w-[150px]'>{label}</label>
|
||||
<p className={`p-1 w-full md:w-3/4 text-sm text-slate-900 dark:text-white ${bg ? bg : null}`}>{value}</p>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -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