Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into market-item-view-popup
This commit was merged in pull request #139.
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 441 KiB |
@@ -5,7 +5,9 @@ import { useNavigate, useLocation, Link } from "react-router-dom";
|
|||||||
import { handlePagingFunc } from "../Pagination/HandlePagination";
|
import { handlePagingFunc } from "../Pagination/HandlePagination";
|
||||||
import PaginatedList from "../Pagination/PaginatedList";
|
import PaginatedList from "../Pagination/PaginatedList";
|
||||||
|
|
||||||
export default function FamilyTable({ className, familyList, loader }) {
|
import familyImage from '../../assets/images/no-family-side.png'
|
||||||
|
|
||||||
|
export default function FamilyTable({ className, familyList, loader, popUpHandler }) {
|
||||||
const filterCategories = ["All Categories", "Explore", "Featured"];
|
const filterCategories = ["All Categories", "Explore", "Featured"];
|
||||||
const [selectedCategory, setCategory] = useState(filterCategories[0]);
|
const [selectedCategory, setCategory] = useState(filterCategories[0]);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -32,9 +34,11 @@ export default function FamilyTable({ className, familyList, loader }) {
|
|||||||
<div className="h-full min-h-[500px] w-full overflow-hidden flex justify-center items-center">
|
<div className="h-full min-h-[500px] w-full overflow-hidden flex justify-center items-center">
|
||||||
<LoadingSpinner size="16" color="sky-blue" />
|
<LoadingSpinner size="16" color="sky-blue" />
|
||||||
</div>
|
</div>
|
||||||
) : (
|
)
|
||||||
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400 relative">
|
:
|
||||||
<>
|
familyList?.length > 0 ?
|
||||||
|
(
|
||||||
|
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400 relative">
|
||||||
<thead className="sticky top-0">
|
<thead className="sticky top-0">
|
||||||
<tr className="text-base text-thin-light-gray whitespace-nowrap border-b dark:border-[#5356fb29] default-border-bottom ">
|
<tr className="text-base text-thin-light-gray whitespace-nowrap border-b dark:border-[#5356fb29] default-border-bottom ">
|
||||||
<th className="py-4">Name</th>
|
<th className="py-4">Name</th>
|
||||||
@@ -44,9 +48,7 @@ export default function FamilyTable({ className, familyList, loader }) {
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody className="h-full">
|
<tbody className="h-full">
|
||||||
<>
|
{currentFamilyList?.map((props, idx) => {
|
||||||
{familyList?.length > 0 ? (
|
|
||||||
currentFamilyList?.map((props, idx) => {
|
|
||||||
let {
|
let {
|
||||||
firstname,
|
firstname,
|
||||||
lastname,
|
lastname,
|
||||||
@@ -115,18 +117,29 @@ export default function FamilyTable({ className, familyList, loader }) {
|
|||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
) : (
|
}
|
||||||
<tr className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
|
|
||||||
<td className="p-2" colSpan="4">
|
|
||||||
No Family Accounts Found!
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</>
|
</table>
|
||||||
</table>
|
)
|
||||||
)}
|
:
|
||||||
|
(
|
||||||
|
<div className="font-bold text-center text-xl md:text-2xl lg:text-4xl text-dark-gray md:flex items-center justify-between">
|
||||||
|
<div className="p-2 w-full md:w-1/2">
|
||||||
|
<p className="mb-4 p-3 md:p-16">Add your family, assign tasks, and get the whole team engaged.</p>
|
||||||
|
<button
|
||||||
|
onClick={popUpHandler}
|
||||||
|
type="button"
|
||||||
|
className="text-white btn-gradient text-lg tracking-wide px-5 py-2 rounded-full"
|
||||||
|
>
|
||||||
|
Add Family
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="p-2 w-full md:w-1/2">
|
||||||
|
<img className='w-full' src={familyImage} alt="A Family" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
{/* PAGINATION BUTTON */}
|
{/* PAGINATION BUTTON */}
|
||||||
<PaginatedList
|
<PaginatedList
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ export default function FamilyAcc() {
|
|||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<FamilyTable familyList={familyList} loader={loader} />
|
<FamilyTable familyList={familyList} loader={loader} popUpHandler={popUpHandler} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{popUp && (
|
{popUp && (
|
||||||
|
|||||||
@@ -96,57 +96,54 @@ function ActiveJobs(props) {
|
|||||||
|
|
||||||
// FUNCTION TO SEND FILES
|
// FUNCTION TO SEND FILES
|
||||||
const sendFile = async () => {
|
const sendFile = async () => {
|
||||||
setRequestStatus({loading: true, status: false, message: ''})
|
setRequestStatus({loading: true, status: false, message: ''})
|
||||||
|
|
||||||
if(!filesToSend.length){ // checks if file to send is empty
|
if(!filesToSend.length){ // checks if file to send is empty
|
||||||
setRequestStatus({loading: false, status: false, message: 'No File(s) selected'})
|
setRequestStatus({loading: false, status: false, message: 'No File(s) selected'})
|
||||||
return setTimeout(()=>{
|
return setTimeout(()=>{
|
||||||
setRequestStatus({loading: false, status: false, message: ''})
|
setRequestStatus({loading: false, status: false, message: ''})
|
||||||
}, 5000)
|
}, 5000)
|
||||||
}
|
}
|
||||||
// let reqData = new FormData()
|
|
||||||
|
|
||||||
// for(let files of filesToSend){
|
for(let i=0; i<=filesToSend.length-1; i++){ // Loops through files to send array and trigger upload API call
|
||||||
// reqData.append(files.name, files)
|
|
||||||
// }
|
|
||||||
// let reqData={file_size: filesToSend[0].size, file_type: 'image/png', file_data: filesToSend[0], msg_type: 'FILE', contract:props.details.contract}
|
|
||||||
|
|
||||||
// for(let files of filesToSend){
|
const fileToBase64 = async () =>{ // Converts file data to base64 string
|
||||||
// reqData[files.name] = files
|
try {
|
||||||
// }
|
const base64String = await convertFileToBase64(filesToSend[i]);
|
||||||
|
return base64String;
|
||||||
|
} catch (error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const fileToBase64 = async () =>{
|
// if(await !fileToBase64()){
|
||||||
try {
|
// return
|
||||||
const base64String = await convertFileToBase64(filesToSend[0]);
|
// }
|
||||||
return base64String;
|
|
||||||
} catch (error) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(await !fileToBase64()){
|
let reqData={file_name: filesToSend[i].name, file_size: filesToSend[i].size, file_type: 'image/png', file_data: await fileToBase64(), msg_type: 'FILE', contract:props.details.contract}
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
let reqData={file_name: filesToSend[0].name, file_size: filesToSend[0].size, file_type: 'image/png', file_data: await fileToBase64(), msg_type: 'FILE', contract:props.details.contract}
|
ApiCall.sendFiles(reqData).then((res)=>{
|
||||||
|
// if(res.status != 200 || res.data.internal_return < 0){
|
||||||
console.log(reqData)
|
// setRequestStatus({loading: false, status: false, message: 'Files(s) could not be sent, try again later'})
|
||||||
ApiCall.sendFiles(reqData).then((res)=>{
|
// return
|
||||||
if(res.status != 200 || res.data.internal_return < 0){
|
// }
|
||||||
setRequestStatus({loading: false, status: false, message: 'Files(s) could not be sent, try again later'})
|
// setRequestStatus({loading: false, status: true, message: 'File(s) Uploaded Successfully'})
|
||||||
return
|
// props.reloadActiveJobList(prev => !prev) // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
||||||
}
|
// setFilesToSend([]) // SETS FILES TO SEND TO SEND BACK TO EMPTY ARRAY
|
||||||
setRequestStatus({loading: false, status: true, message: 'File(s) Uploaded Successfully'})
|
}).catch(error => {
|
||||||
props.reloadActiveJobList(prev => !prev) // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
// setRequestStatus({loading: false, status: false, message: 'Opps! something went wrong'})
|
||||||
setFilesToSend([]) // SETS FILES TO SEND TO SEND BACK TO EMPTY ARRAY
|
}).finally(()=>{
|
||||||
}).catch(error => {
|
if(i==filesToSend.length-1){
|
||||||
setRequestStatus({loading: false, status: false, message: 'Opps! something went wrong'})
|
setRequestStatus({loading: false, status: true, message: 'File(s) Uploaded Successfully'})
|
||||||
}).finally(()=>{
|
setFilesToSend([]) // SETS FILES TO SEND TO SEND BACK TO EMPTY ARRAY
|
||||||
setTimeout(()=>{
|
props.reloadActiveJobList(prev => !prev) // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
||||||
setRequestStatus({loading: false, status: false, message: ''})
|
setTimeout(()=>{
|
||||||
}, 5000)
|
setRequestStatus({loading: false, status: false, message: ''})
|
||||||
})
|
}, 5000)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
|
|||||||
@@ -563,7 +563,9 @@ class usersService {
|
|||||||
for (let data in postData) {
|
for (let data in postData) {
|
||||||
formData.append(data, postData[data]);
|
formData.append(data, postData[data]);
|
||||||
}
|
}
|
||||||
return this.postAuxEnd("/uploads", formData);
|
// return this.postAuxEnd("/uploads", formData);
|
||||||
|
|
||||||
|
return this.postAuxEnd("/uploads", postData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// END POINT TO DELETE A JOB
|
// END POINT TO DELETE A JOB
|
||||||
|
|||||||
Reference in New Issue
Block a user