Compare commits

..

14 Commits

Author SHA1 Message Date
victorAnumudu 1f5fb8c7c3 upload file bug fixed 2023-11-28 11:50:16 +01:00
victorAnumudu a303b24b53 upload file bug fixed 2023-11-28 11:33:59 +01:00
victorAnumudu 322927045c Merge master into upload_download_link 2023-11-28 03:18:45 +01:00
victorAnumudu 3cf1dc7166 added download link# 2023-11-28 03:17:23 +01:00
ameye 8ed331e909 Merge branch 'wrong-upload-placeholder' of WrenchBoard/Users-Wrench into master 2023-11-28 01:42:14 +00:00
ameye 2428923f73 Merge branch 'file_link_bug' of WrenchBoard/Users-Wrench into master 2023-11-28 01:41:53 +00:00
victorAnumudu 139f87c919 corrected wrong placeholders 2023-11-28 02:16:49 +01:00
victorAnumudu c24fbedf2c file link updated 2023-11-27 12:49:18 +01:00
ameye 1a817e723e Merge branch 'Server-path-added' of WrenchBoard/Users-Wrench into master 2023-11-27 11:31:03 +00:00
ebube c023911cd4 Fixed prev card issue 2023-11-27 03:19:39 -08:00
ameye 907dc298ab Merge branch 'file_link_update' of WrenchBoard/Users-Wrench into master 2023-11-27 10:32:02 +00:00
ameye 8095006386 Merge branch 'Server-path-added' of WrenchBoard/Users-Wrench into master 2023-11-27 10:31:57 +00:00
ebube d9d28791da Added and specified card_uid for prev and new card 2023-11-27 01:49:09 -08:00
ebube a98d967ba4 Fixed the credit issues 2023-11-27 01:12:24 -08:00
9 changed files with 102 additions and 58 deletions
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" id="DownloadArrow"><g fill="#4687ba" class="color9a7baa svgShape"><path d="M30.179 3.525V1.857c0-1.551-1.784-2.415-3.011-1.449L24 2.907 20.824.402c-1.216-.959-3.002-.093-3.002 1.456v1.668a1 1 0 0 0 1 1h10.357c.552-.001 1-.449 1-1.001zM30.179 25.172v-2.524a1 1 0 0 0-1-1H18.822a1 1 0 0 0-1 1v2.524a1 1 0 0 0 1 1h10.357a1 1 0 0 0 1-1zM30.179 10.74V8.217a1 1 0 0 0-1-1H18.822a1 1 0 0 0-1 1v2.524a1 1 0 0 0 1 1h10.357c.552-.001 1-.448 1-1.001zM30.179 17.956v-2.524a1 1 0 0 0-1-1H18.822a1 1 0 0 0-1 1v2.524a1 1 0 0 0 1 1h10.357a1 1 0 0 0 1-1zM25.748 47.029l9.336-15.018c.852-1.371-.133-3.145-1.748-3.145H14.664c-1.614 0-2.6 1.774-1.748 3.145l9.336 15.018a2.058 2.058 0 0 0 3.496 0z" fill="#000000" class="color000000 svgShape"></path></g></svg>

After

Width:  |  Height:  |  Size: 799 B

@@ -32,7 +32,7 @@ export default function ActiveJobMessage({ activeJobMesList }) {
<tbody> <tbody>
{activeJobMesList.data.map((item, index) => {activeJobMesList.data.map((item, index) =>
{ {
let imageLink = `${activeJobMesList?.image}${localStorage.getItem('session_token')}/contrats/${item.msg_uid}` let imageLink = `${activeJobMesList?.image}${localStorage.getItem('session_token')}/contracts/${item.msg_uid}`
return ( return (
<tr key={index} className='text-slate-500'> <tr key={index} className='text-slate-500'>
<td> <td>
@@ -64,17 +64,21 @@ const initialValues = {
}; };
function AddFundDollars(props) { function AddFundDollars(props) {
let MaxNoOfCards = process.env.REACT_APP_MAX_CREDIT_CARDS // HOLDS THE VALUE OF THE MAX NUMBER OF CARDS USER CAN ADD let MaxNoOfCards = process.env.REACT_APP_MAX_CREDIT_CARDS; // HOLDS THE VALUE OF THE MAX NUMBER OF CARDS USER CAN ADD
const apiCall = new usersService(); const apiCall = new usersService();
let countryWallet = props.walletItem.country; let countryWallet = props.walletItem.country;
const [tab, setTab] = useState("previous"); const [selectedOption, setSelectedOption] = useState("previous");
const { userDetails } = useSelector((state) => state?.userDetails); const { userDetails } = useSelector((state) => state?.userDetails);
const [prevCardDetails, setPrevCardDetails] = useState({}); const [prevCardDetails, setPrevCardDetails] = useState({});
const [payListCards, setPayListCards] = useState({ loading: true, data: [] }); const [payListCards, setPayListCards] = useState({ loading: true, data: [] });
const [cardIcons, setCardIcons] = useState("atm-card"); const [cardIcons, setCardIcons] = useState("atm-card");
const [prevCardError, setPrevCardError] = useState(""); const [prevCardError, setPrevCardError] = useState("");
const handleOptionChange = (event) => {
setSelectedOption(event.target.value);
};
const { firstname, lastname } = userDetails; const { firstname, lastname } = userDetails;
// Handling Card Icons // Handling Card Icons
@@ -144,7 +148,12 @@ function AddFundDollars(props) {
return; return;
} }
if (tab === "previous") { let stateData = {
amount: Number(props.input) * 100,
currency: props.walletItem?.code,
};
if (selectedOption === "previous") {
// To check if card is empty // To check if card is empty
if (Object.keys(prevCardDetails).length === 0) { if (Object.keys(prevCardDetails).length === 0) {
setPrevCardError("No card selected!"); setPrevCardError("No card selected!");
@@ -158,10 +167,26 @@ function AddFundDollars(props) {
show: { awaitConfirm: { loader: true } }, show: { awaitConfirm: { loader: true } },
})); }));
let stateData = { // Extracting card_uid from the previous card details
amount: Number(props.input) * 100, const paymentCardValue = prevCardDetails["payment-card"];
currency: props.walletItem?.code,
}; if (paymentCardValue) {
try {
const paymentCardObject = JSON.parse(paymentCardValue);
stateData = {
...stateData,
card_uid: paymentCardObject.card_uid,
};
} catch (error) {
console.error("Error parsing JSON:", error);
}
} else {
// For the new card details
stateData = {
...stateData,
card_uid: "",
};
}
try { try {
const res = await apiCall.getStartCredit(stateData); const res = await apiCall.getStartCredit(stateData);
@@ -171,12 +196,11 @@ function AddFundDollars(props) {
} }
const _response = res.data; const _response = res.data;
stateData.amount = Number(props.input);
stateData.card = stateData.card =
tab === "previous" selectedOption === "previous"
? prevCardDetails["payment-card"] ? prevCardDetails["payment-card"]
: { ...values, cvv: values.cvv }; : { ...values, cvv: values.cvv };
stateData.cardType = tab === "previous" ? "prev" : "new"; stateData.cardType = selectedOption === "previous" ? "prev" : "new";
stateData = { ...stateData, ..._response }; stateData = { ...stateData, ..._response };
setTimeout(() => { setTimeout(() => {
@@ -224,36 +248,45 @@ function AddFundDollars(props) {
</h1> </h1>
<div className="my-1 flex items-center gap-2"> <div className="my-1 flex items-center gap-2">
<label <label
onClick={() => setTab("previous")}
htmlFor="previous" htmlFor="previous"
className="cursor-pointer flex items-center gap-1" className="cursor-pointer flex items-center gap-1"
> >
<input <input
type="radio" type="radio"
id="previous" id="previous"
value="previous"
name="card-option" name="card-option"
checked={tab === "previous"} onChange={handleOptionChange}
checked={selectedOption === "previous"}
className={`p-2 text-lg font-bold text-slate-600 dark:text-white border pointer-events-none w-7 h-7 ${ className={`p-2 text-lg font-bold text-slate-600 dark:text-white border pointer-events-none w-7 h-7 ${
tab == "previous" ? "" : "" selectedOption == "previous" ? "" : ""
} tracking-wide transition duration-200`} } tracking-wide transition duration-200`}
/> />
Previous Cards Previous Cards
</label> </label>
<label <label
onClick={() => setTab("new")}
htmlFor="new" htmlFor="new"
className={`cursor-pointer flex items-center gap-1 ${payListCards.data.length >= MaxNoOfCards ? 'pointer-events-none':''}`} className={`cursor-pointer flex items-center gap-1 ${
payListCards.data.length >= MaxNoOfCards
? "pointer-events-none"
: ""
}`}
> >
<input <input
id="new" id="new"
type="radio" type="radio"
name="card-option" name="card-option"
checked={tab === "new"} value="new"
onChange={handleOptionChange}
checked={selectedOption === "new"}
className={`p-2 text-lg font-bold text-slate-600 dark:text-white border pointer-events-none w-7 h-7 ${ className={`p-2 text-lg font-bold text-slate-600 dark:text-white border pointer-events-none w-7 h-7 ${
tab == "new" ? "" : "" selectedOption == "new" ? "" : ""
} tracking-wide transition duration-200`} } tracking-wide transition duration-200`}
/> />
Add New Card {payListCards.data.length >= MaxNoOfCards && <span className="text-[14px] text-red-500">Max Reached</span>} Add New Card{" "}
{payListCards.data.length >= MaxNoOfCards && (
<span className="text-[14px] text-red-500">Max Reached</span>
)}
</label> </label>
</div> </div>
</form> </form>
@@ -261,8 +294,8 @@ function AddFundDollars(props) {
<hr /> <hr />
{/* END OF switch button */} {/* END OF switch button */}
{/* previous tab */} {/* previous selectedOption */}
{tab === "previous" && ( {selectedOption === "previous" && (
<div className="p-4 previous-details w-full min-h-[16.5rem] flex flex-col"> <div className="p-4 previous-details w-full min-h-[16.5rem] flex flex-col">
{payListCards.loading ? ( {payListCards.loading ? (
<LoadingSpinner size="10" color="sky-blue" /> <LoadingSpinner size="10" color="sky-blue" />
@@ -278,10 +311,11 @@ function AddFundDollars(props) {
{currentPreviousCards.map((item, index) => ( {currentPreviousCards.map((item, index) => (
<option <option
key={index} key={index}
className={index !== 0 && "border-t-2"} className={index !== 0 ? "border-t-2" : undefined}
value={JSON.stringify(item)} value={JSON.stringify(item)}
title={`${item.description} Card\nBank **************${item.digits}`}
> >
<div className="my-2 flex items-center gap-5"> {/* <div className="my-2 flex items-center gap-5">
<div className="card-details"> <div className="card-details">
<h1 className="text-lg font-bold text-dark-gray dark:text-white tracking-wide"> <h1 className="text-lg font-bold text-dark-gray dark:text-white tracking-wide">
{item.description} Card {item.description} Card
@@ -290,7 +324,8 @@ function AddFundDollars(props) {
Bank **************{item.digits} Bank **************{item.digits}
</p> </p>
</div> </div>
</div> </div> */}
{item.description} Card - Bank **************{item.digits}
</option> </option>
))} ))}
</select> </select>
@@ -300,7 +335,7 @@ function AddFundDollars(props) {
No Previous Card Found! No Previous Card Found!
</p> </p>
<button <button
onClick={() => setTab("new")} onClick={() => setSelectedOption("new")}
type="button" type="button"
className="my-5 px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white" className="my-5 px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
> >
@@ -314,13 +349,13 @@ function AddFundDollars(props) {
</div> </div>
)} )}
{tab === "new" && ( {selectedOption === "new" && (
<div className="new-details w-full max-h-[22rem]"> <div className="new-details w-full max-h-[22rem]">
{payListCards.loading ? {payListCards.loading ? (
<div className="pt-10 flex w-full h-full justify-center items-center"> <div className="pt-10 flex w-full h-full justify-center items-center">
<LoadingSpinner size='10' color='sky-blue' /> <LoadingSpinner size="10" color="sky-blue" />
</div> </div>
:payListCards.data.length < MaxNoOfCards ? ) : payListCards.data.length < MaxNoOfCards ? (
<div className="w-full flex flex-col justify-between"> <div className="w-full flex flex-col justify-between">
<Formik <Formik
initialValues={initialValues} initialValues={initialValues}
@@ -379,7 +414,8 @@ function AddFundDollars(props) {
* *
</span> </span>
<span className="text-[12px] text-red-500 ml-1"> <span className="text-[12px] text-red-500 ml-1">
{props.errors.expirationMonth && "**"} {props.errors.expirationMonth &&
"**"}
</span> </span>
</label> </label>
</div> </div>
@@ -431,7 +467,8 @@ function AddFundDollars(props) {
* *
</span> </span>
<span className="text-[12px] text-red-500 italic"> <span className="text-[12px] text-red-500 italic">
{props.errors.expirationYear && "**"} {props.errors.expirationYear &&
"**"}
</span> </span>
</label> </label>
</div> </div>
@@ -560,14 +597,12 @@ function AddFundDollars(props) {
}} }}
</Formik> </Formik>
</div> </div>
: ) : null}
null
}
</div> </div>
)} )}
</div> </div>
{tab == "previous" && ( {selectedOption == "previous" && (
<div className="md:py-8 add-fund-btn flex justify-end items-center gap-2 py-4"> <div className="md:py-8 add-fund-btn flex justify-end items-center gap-2 py-4">
<button <button
className="px-4 py-1 h-11 max-w-[100px] w-full flex justify-center bg-[#f5a430] text-black items-center text-base rounded-full" className="px-4 py-1 h-11 max-w-[100px] w-full flex justify-center bg-[#f5a430] text-black items-center text-base rounded-full"
@@ -71,6 +71,7 @@ function AddFundPop({
// Prepare state data for API call // Prepare state data for API call
let stateData = { let stateData = {
amount: Number(input) * 100, amount: Number(input) * 100,
card_uid: "", //added card_uid as empty string
currency: walletItem?.code, currency: walletItem?.code,
}; };
@@ -45,7 +45,7 @@ function ThePaymentText({ value, type }) {
* @returns {JSX.Element} - The rendered component. * @returns {JSX.Element} - The rendered component.
*/ */
function AmountSection({ currency, amount, country }) { function AmountSection({ currency, amount, country }) {
const formattedAmount = amount?.toFixed(2); const formattedAmount = (+amount * 0.01)?.toFixed(2);
const gapClassName = country === "US" ? "gap-14" : "gap-4"; const gapClassName = country === "US" ? "gap-14" : "gap-4";
return ( return (
@@ -87,7 +87,7 @@ function TransactionFeeSection({ currency, fee, country }) {
*/ */
function TotalSection({ currency, amount, fee, country }) { function TotalSection({ currency, amount, fee, country }) {
const total = Number(amount) + Number(fee); const total = Number(amount) + Number(fee);
const formattedTotal = total?.toFixed(2); const formattedTotal = (total * 0.01)?.toFixed(2);
const gap = country === "US" ? "gap-[8rem]" : "gap-[6.3rem]"; const gap = country === "US" ? "gap-[8rem]" : "gap-[6.3rem]";
@@ -224,7 +224,7 @@ function ConfirmAddFund({
// Create request data object with required parameters for making the payment // Create request data object with required parameters for making the payment
const reqData = { const reqData = {
amount: amount * 100, amount: amount,
card_uid, card_uid,
credit_reference, credit_reference,
currency, currency,
@@ -289,7 +289,7 @@ function ConfirmAddFund({
// Prepare request data // Prepare request data
const reqData = { const reqData = {
amount: amount * 100, amount: amount,
cardnumber: cardNum.replace(/\s/g, ""), cardnumber: cardNum.replace(/\s/g, ""),
credit_reference, credit_reference,
cvc: cvv, cvc: cvv,
+1
View File
@@ -63,6 +63,7 @@ export default function Resources(props) {
loading: false, loading: false,
msg: "success", msg: "success",
data: res?.result_list, data: res?.result_list,
image:res?.session_image_server
})); }));
} catch (error) { } catch (error) {
setUploadedFiles((prev) => ({ setUploadedFiles((prev) => ({
@@ -13,7 +13,6 @@ export default function MyUploadedFiles({ uploadedFiles }) {
indexOfFirstItem, indexOfFirstItem,
indexOfLastItem indexOfLastItem
); );
const handlePagination = (e) => { const handlePagination = (e) => {
handlePagingFunc(e, setCurrentPage); handlePagingFunc(e, setCurrentPage);
}; };
@@ -45,10 +44,11 @@ export default function MyUploadedFiles({ uploadedFiles }) {
currentFiles.map((value, idx) => { currentFiles.map((value, idx) => {
let addedDate = value?.added?.split(" ")[0]; let addedDate = value?.added?.split(" ")[0];
let formattedSize = formatFileSize(value?.file_size); let formattedSize = formatFileSize(value?.file_size);
let imageLink = `${uploadedFiles?.image}${localStorage.getItem('session_token')}/myfile/${value.file_uid}`
return ( return (
<tr <tr
key={value?.file_uid} key={value?.file_uid}
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50" className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50"
> >
<td className=" py-4"> <td className=" py-4">
<div className="flex space-x-2 items-center w-full"> <div className="flex space-x-2 items-center w-full">
@@ -102,17 +102,17 @@ export default function MyUploadedFiles({ uploadedFiles }) {
</td> </td>
<td className="text-right py-4 px-2"> <td className="text-right py-4 px-2">
<div className="flex justify-center items-center"> <div className="flex justify-center items-center">
<button <a
type="button" href={imageLink}
// onClick={() => { title="download"
// navigate("/manage-active-job", { // className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
// state: { ...value, pathname },
// });
// }}
className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
> >
View <img
</button> src={localImgLoad('images/icons/download-arrow.svg')}
alt='download-link'
className="w-auto h-6 flex justify-center items-center"
/>
</a>
</div> </div>
</td> </td>
</tr> </tr>
@@ -157,7 +157,7 @@ export default function ProductUploadField({
fieldClass="px-6" fieldClass="px-6"
type="text" type="text"
name="name" name="name"
placeholder="RaidParty Fighters" placeholder="Item Name"
inputHandler={inh} inputHandler={inh}
value={datas.itemName} value={datas.itemName}
/> />
@@ -186,7 +186,7 @@ export default function ProductUploadField({
<textarea <textarea
value={datas.description} value={datas.description}
onChange={(e) => dscrphn(e)} onChange={(e) => dscrphn(e)}
placeholder="provide a detailed description of your item." placeholder="Enter detail description"
rows="7" rows="7"
className="w-full h-full px-7 py-4 border border-light-purple dark:border-[#5356fb29] rounded-[20px] text-dark-gray dark:text-white bg-[#FAFAFA] dark:bg-[#11131F] focus:ring-0 focus:outline-none" className="w-full h-full px-7 py-4 border border-light-purple dark:border-[#5356fb29] rounded-[20px] text-dark-gray dark:text-white bg-[#FAFAFA] dark:bg-[#11131F] focus:ring-0 focus:outline-none"
/> />
+10 -4
View File
@@ -147,7 +147,7 @@ export default function UploadProduct({uploadTypes}) {
file_name: selectedFile.substring(0,21).replace(/ /gi, ""),//selectedFile.replace(/[ -]/gi, ""), file_name: selectedFile.substring(0,21).replace(/ /gi, ""),//selectedFile.replace(/[ -]/gi, ""),
file_size: imgDetails.size, file_size: imgDetails.size,
file_type: imgDetails.type, file_type: imgDetails.type,
file_data: img.file, file_data: img.file?.split(",")[1],
title: itemName, title: itemName,
description: description, description: description,
msg_type: 'FILE', msg_type: 'FILE',
@@ -602,7 +602,10 @@ export default function UploadProduct({uploadTypes}) {
//FUNCTIONS to check if file upload type is valid //FUNCTIONS to check if file upload type is valid
const isValidFile = (file, supportedFile=[]) => { const isValidFile = (file, supportedFile=[]) => {
let fileType = file.type.split("/")[1]; let fileType = file.type.split("/")[1].toLowerCase();
if(fileType=='jpg' || fileType=='jpeg'){ //forcing both JPG and JPEG TO RETURN JPG AS FILE TYPE
fileType = 'jpg'
}
let valid = supportedFile.filter(item => ( let valid = supportedFile.filter(item => (
item.name.toLowerCase() == fileType.toLowerCase() item.name.toLowerCase() == fileType.toLowerCase()
)) ))
@@ -615,7 +618,10 @@ const isValidFile = (file, supportedFile=[]) => {
//FUNCTIONS TO CHECK IF FILE SIZE IS VALID //FUNCTIONS TO CHECK IF FILE SIZE IS VALID
const isValidFileSize = (file, supportedFile=[]) => { const isValidFileSize = (file, supportedFile=[]) => {
let fileType = file.type.split("/")[1]; let fileType = file.type.split("/")[1].toLowerCase();
if(fileType=='jpg' || fileType=='jpeg'){ //forcing both JPG and JPEG TO RETURN JPG AS FILE TYPE
fileType = 'jpg'
}
let fileSize = file.size; let fileSize = file.size;
let valid = supportedFile.filter(item => ( let valid = supportedFile.filter(item => (
item.name.toLowerCase() == fileType.toLowerCase() item.name.toLowerCase() == fileType.toLowerCase()
@@ -627,6 +633,6 @@ const isValidFileSize = (file, supportedFile=[]) => {
return {status: false, message: `File must not exceed ${valid[0].max_size_mb}MB`} return {status: false, message: `File must not exceed ${valid[0].max_size_mb}MB`}
} }
}else{ }else{
return false return {status: false, message: `Cannot read file size, try again`}
} }
} }