Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ad49489377 | |||
| 386fc8cb0c | |||
| 0045a791fe | |||
| b48cb48213 | |||
| 856c70628a |
@@ -88,10 +88,10 @@ export default function AssignMediaTask({
|
|||||||
<Form>
|
<Form>
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
className={`job-action-modal-body w-full min-h-[450px] max-h-[450px] overflow-y-auto md:grid md:grid-cols-2`}
|
className={`job-action-modal-body w-full h-[500px] overflow-y-auto md:grid md:grid-cols-2`}
|
||||||
>
|
>
|
||||||
<div className="p-4 pt-0">
|
<div className="p-4 pt-0">
|
||||||
<div className="p-4 w-full min-h-[410px] max-h-[410px] overflow-y-auto bg-slate-100 rounded-md dark:bg-[#11131f] dark:text-white">
|
<div className="p-4 w-full h-[450px] overflow-y-auto bg-slate-100 rounded-md dark:bg-[#11131f] dark:text-white">
|
||||||
{commonMedia?.data?.length ? (
|
{commonMedia?.data?.length ? (
|
||||||
commonMedia?.data?.map((item, index) => (
|
commonMedia?.data?.map((item, index) => (
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import LoadingSpinner from '../../Spinners/LoadingSpinner'
|
|||||||
import { NewTasks } from './forms'
|
import { NewTasks } from './forms'
|
||||||
import { PriceFormatter } from '../../Helpers/PriceFormatter'
|
import { PriceFormatter } from '../../Helpers/PriceFormatter'
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
|
import AttachFile from '../../attachmentCom/AttachFile';
|
||||||
|
|
||||||
export default function AssignPrevNewTask({
|
export default function AssignPrevNewTask({
|
||||||
jobList,
|
jobList,
|
||||||
@@ -32,7 +33,7 @@ export default function AssignPrevNewTask({
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
className={`job-action-modal-body w-full min-h-[450px] max-h-[450px] overflow-y-auto md:grid ${
|
className={`job-action-modal-body w-full h-[500px] overflow-y-auto md:grid ${
|
||||||
taskType !== "new" ? "md:grid-cols-2" : "md:grid-cols-1"
|
taskType !== "new" ? "md:grid-cols-2" : "md:grid-cols-1"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
@@ -63,7 +64,7 @@ export default function AssignPrevNewTask({
|
|||||||
</div>
|
</div>
|
||||||
{/* Task Type === select */}
|
{/* Task Type === select */}
|
||||||
{taskType == "select" && (
|
{taskType == "select" && (
|
||||||
<div className="p-4 w-full h-[400px] overflow-y-auto bg-slate-100 rounded-md dark:bg-[#11131f] dark:text-white">
|
<div className="p-4 w-full h-[450px] overflow-y-auto bg-slate-100 rounded-md dark:bg-[#11131f] dark:text-white">
|
||||||
{jobList?.data?.length ? (
|
{jobList?.data?.length ? (
|
||||||
jobList?.data?.map((item, index) => (
|
jobList?.data?.map((item, index) => (
|
||||||
<div
|
<div
|
||||||
@@ -151,7 +152,7 @@ export default function AssignPrevNewTask({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full flex items-center justify-center">
|
<div className="w-full flex items-center justify-center">
|
||||||
<div className="w-28 h-28 rounded-2xl flex items-center justify-center">
|
<div className="mb-1 w-28 h-28 rounded-2xl flex items-center justify-center">
|
||||||
<img
|
<img
|
||||||
className="w-full h-auto"
|
className="w-full h-auto"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
@@ -162,13 +163,10 @@ export default function AssignPrevNewTask({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Dummy, no value found for created! thus commented*/}
|
{/* ATTACHMENT SECTION*/}
|
||||||
{/* <div className="my-3 sm:flex items-center">
|
<div className="w-full max-h-28">
|
||||||
<Detail
|
<AttachFile data={activeTask.data} />
|
||||||
label="Created"
|
</div>
|
||||||
value={`Dummy, no value found for created!`}
|
|
||||||
/>
|
|
||||||
</div> */}
|
|
||||||
|
|
||||||
<div className="my-3">
|
<div className="my-3">
|
||||||
<label className="w-full job-label">
|
<label className="w-full job-label">
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
import React, { useRef, useState } from 'react'
|
||||||
|
import LoadingSpinner from '../Spinners/LoadingSpinner'
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
|
export default function AttachFile({data}) {
|
||||||
|
|
||||||
|
const [requestStatus, setRequestStatus] = useState({loading: false, status:false, message:''})
|
||||||
|
|
||||||
|
const inputFile = useRef()
|
||||||
|
|
||||||
|
const upload = (event) => {
|
||||||
|
let inputs = {
|
||||||
|
file: event.target.files[0],
|
||||||
|
job_uid: data?.job_uid,
|
||||||
|
uid: localStorage.getItem("uid"),
|
||||||
|
// member_id: localStorage.getItem("member_id"),
|
||||||
|
sessionid: localStorage.getItem("session_token"),
|
||||||
|
};
|
||||||
|
setRequestStatus({loading: true, status:false, message:''})
|
||||||
|
if(!inputs.file){
|
||||||
|
setRequestStatus({loading: false, status:false, message:'Please select a file'})
|
||||||
|
setTimeout(()=>{
|
||||||
|
setRequestStatus({loading: false, status:false, message:''})
|
||||||
|
}, 3000)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const formData = new FormData()
|
||||||
|
for (let input in inputs) {
|
||||||
|
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){
|
||||||
|
inputFile.current.value = null
|
||||||
|
setRequestStatus({loading: false, status:false, message:'upload failed'})
|
||||||
|
setTimeout(()=>{
|
||||||
|
setRequestStatus({loading: false, status:false, message:''})
|
||||||
|
}, 3000)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// console.log('RESPONSE', res.data)
|
||||||
|
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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
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>
|
||||||
|
}
|
||||||
|
</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='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>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ import InputCom from "../Helpers/Inputs/InputCom";
|
|||||||
import ModalCom from "../Helpers/ModalCom";
|
import ModalCom from "../Helpers/ModalCom";
|
||||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||||
import { apiConst } from "../../lib/apiConst";
|
import { apiConst } from "../../lib/apiConst";
|
||||||
|
import AttachFile from "../attachmentCom/AttachFile";
|
||||||
|
|
||||||
const validationSchema = Yup.object().shape({
|
const validationSchema = Yup.object().shape({
|
||||||
country: Yup.string()
|
country: Yup.string()
|
||||||
@@ -301,7 +302,7 @@ const EditJobPopoutNew = ({
|
|||||||
<Field
|
<Field
|
||||||
component="select"
|
component="select"
|
||||||
name="timeline_days"
|
name="timeline_days"
|
||||||
className={`input-field p-2 mt-3 rounded-md placeholder:text-base text-dark-gray dark:text-white w-full h-10 bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-none ${
|
className={`input-field p-2 mt-3 rounded-full placeholder:text-base text-dark-gray w-full h-[42px] bg-slate-100 focus:ring-0 focus:outline-none ${
|
||||||
props.errors.timeline_days &&
|
props.errors.timeline_days &&
|
||||||
props.touched.timeline_days
|
props.touched.timeline_days
|
||||||
? "border-[#ff0a0a63] shadow-red-500 border-[0.5px] animate-shake"
|
? "border-[#ff0a0a63] shadow-red-500 border-[0.5px] animate-shake"
|
||||||
@@ -419,15 +420,22 @@ const EditJobPopoutNew = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full flex items-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"
|
<label
|
||||||
htmlFor="timeline_days"
|
className={`w-full job-label cursor-pointer ${uploadStatus.loading && 'pointer-events-none'}`}
|
||||||
>
|
htmlFor="task_image"
|
||||||
Banner
|
>
|
||||||
</label>
|
Banner
|
||||||
|
</label>
|
||||||
|
{uploadStatus.loading ?
|
||||||
|
<LoadingSpinner size='6' />
|
||||||
|
:
|
||||||
|
<span className={`text-[10px] ${uploadStatus.status ? 'text-emerald-600' : 'text-red-500'}`}>{uploadStatus.message}</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
<input
|
<input
|
||||||
id="task_image"
|
id="task_image"
|
||||||
className="hidden"
|
className="hidden"
|
||||||
@@ -465,7 +473,7 @@ const EditJobPopoutNew = ({
|
|||||||
{/* END OF TASK IMAGE */}
|
{/* END OF TASK IMAGE */}
|
||||||
|
|
||||||
<div className="field w-2/3">
|
<div className="field w-2/3">
|
||||||
{/* PUT SPACE HERE */}
|
<AttachFile data={details} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -492,25 +500,6 @@ const EditJobPopoutNew = ({
|
|||||||
)
|
)
|
||||||
))}
|
))}
|
||||||
{/* End of error or success display */}
|
{/* End of error or success display */}
|
||||||
|
|
||||||
{/* DISPLAYS TASK IMAGE UPLOADING STATUS */}
|
|
||||||
<div className="w-full">
|
|
||||||
{uploadStatus.message && !uploadStatus.loading && (
|
|
||||||
<p
|
|
||||||
className={`text-center ${
|
|
||||||
uploadStatus.status
|
|
||||||
? "text-green-500"
|
|
||||||
: "text-red-500"
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
{uploadStatus.message}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
{uploadStatus.loading && (
|
|
||||||
<p className="text-center">{uploadStatus.message}</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="modal-footer-wrapper justify-end">
|
<div className="modal-footer-wrapper justify-end">
|
||||||
|
|||||||
Reference in New Issue
Block a user