Compare commits

..

8 Commits

Author SHA1 Message Date
victorAnumudu 630ccefa51 Made the email input longer 2024-03-21 12:20:20 +01:00
ameye 4e81156d72 Merge branch 'parent-kid-wallet' of WrenchBoard/Users-Wrench into master 2024-03-21 09:50:41 +00:00
ameye e402c02c1f Merge branch 'assign-task-image' of WrenchBoard/Users-Wrench into master 2024-03-21 09:50:34 +00:00
victorAnumudu 5907b5d872 parent kids wallet bug fixed 2024-03-20 21:04:49 +01:00
victorAnumudu 042cc4110c initial commit 2024-03-20 19:16:16 +01:00
tokslaw 5e6b208513 Merge branch 'family-wallet-refresh' of WrenchBoard/Users-Wrench into master 2024-03-20 13:32:48 +00:00
victorAnumudu 762601a5c3 made kid wallet refresh when parent transfers cash 2024-03-20 13:44:14 +01:00
victorAnumudu 1e28a0e15b made kid wallet refresh when parent transfers cash 2024-03-20 13:43:23 +01:00
9 changed files with 67 additions and 27 deletions
@@ -65,6 +65,9 @@ export default function SocketIOContextProvider({children}) {
if(message.action == "REFRESH_TASK" && message.audience == "PARENT"){ // for refreshing parent account when child accepts or rejects a job if(message.action == "REFRESH_TASK" && message.audience == "PARENT"){ // for refreshing parent account when child accepts or rejects a job
dispatch(tableReload({type:'PARENTFAMILYTASKLIST'})) // dispatches to update parent family task list on parent side dispatch(tableReload({type:'PARENTFAMILYTASKLIST'})) // dispatches to update parent family task list on parent side
} }
if(message.action == "REFRESH_WALLET" && message.family_uid == user_uid && message.audience == "MEMBER"){ // for refreshing child wallet account when parent sends money to kid
dispatch(tableReload({type:'WALLETTABLE'})) // dispatches to update wallet balance on family side
}
// console.log('DATA', data) // console.log('DATA', data)
}); });
}, [socket]); }, [socket]);
@@ -15,8 +15,10 @@ function FamilyWallet({familyData}) {
useEffect(()=>{ useEffect(()=>{
setFamilyWallet({loading:true, data: []}) setFamilyWallet({loading:true, data: []})
apiUrl.getFamilyWallet({family_uid:familyData?.uid}).then(res => { apiUrl.getKidWallets({family_uid:familyData?.uid}).then(res => {
setFamilyWallet({loading:false, data: res?.data?.result_list || []}) setFamilyWallet({loading:false, data: res?.data?.result_list || []})
console.log('familyData', familyData, res?.data?.result_list)
}).catch(error => { }).catch(error => {
setFamilyWallet({loading:false, data: []}) setFamilyWallet({loading:false, data: []})
}) })
@@ -9,8 +9,9 @@ import usersService from "../../../../services/UsersService";
import LoadingSpinner from "../../../Spinners/LoadingSpinner"; import LoadingSpinner from "../../../Spinners/LoadingSpinner";
import { PriceFormatter } from "../../../Helpers/PriceFormatter"; import { PriceFormatter } from "../../../Helpers/PriceFormatter";
import { tableReload } from "../../../../store/TableReloads"; import { tableReload } from "../../../../store/TableReloads";
import { useDispatch } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { apiConst } from "../../../../lib/apiConst"; import { apiConst } from "../../../../lib/apiConst";
import { SocketValues } from "../../../Contexts/SocketIOContext";
const validationSchema = Yup.object().shape({ const validationSchema = Yup.object().shape({
// amount: Yup.string() // amount: Yup.string()
@@ -30,6 +31,11 @@ const validationSchema = Yup.object().shape({
}); });
function FamilyAddFundPopout({ action, situation, wallet, familyData }) { function FamilyAddFundPopout({ action, situation, wallet, familyData }) {
const {userDetails} = useSelector((state) => state?.userDetails); // Gets User Detail
const { parentAssignJobToKid } = SocketValues() // socket emit event from FULL account
const dispatch = useDispatch(); const dispatch = useDispatch();
const apiUrl = new usersService(); const apiUrl = new usersService();
@@ -54,6 +60,7 @@ function FamilyAddFundPopout({ action, situation, wallet, familyData }) {
}; };
// FUNCTION TO PERFORM FAMILY TRANSFER // FUNCTION TO PERFORM FAMILY TRANSFER
const handleAddFund = (values) => { const handleAddFund = (values) => {
setRequestStatus({ loading: true, status: false, message: "" }); setRequestStatus({ loading: true, status: false, message: "" });
let senderBal = startTransfer?.data?.origing_current_balance || ""; // SENDER'S ACCOUNT BALANCE let senderBal = startTransfer?.data?.origing_current_balance || ""; // SENDER'S ACCOUNT BALANCE
@@ -132,6 +139,17 @@ function FamilyAddFundPopout({ action, situation, wallet, familyData }) {
status: true, status: true,
message: "Transfer Successful", message: "Transfer Successful",
}); });
//SENDS MESSAGE TO SOCKET TO UPDATE CHILD ACCOUNT
// message, room
let socketMsg = {
"audience": "MEMBER",
"action": "REFRESH_WALLET",
"family_uid": reqData.family_uid,
}
let socketRoom = `FAMILY-${userDetails.uid}`
parentAssignJobToKid(socketMsg, socketRoom) //SENDS MESSAGE TO SOCKET TO UPDATE CHILD ACCOUNT
setTimeout(() => { setTimeout(() => {
setRequestStatus({ loading: false, status: false, message: "" }); setRequestStatus({ loading: false, status: false, message: "" });
dispatch(tableReload({ type: "WALLETTABLE" })); // UPDATES PARENT WALLET ACCOUNT dispatch(tableReload({ type: "WALLETTABLE" })); // UPDATES PARENT WALLET ACCOUNT
@@ -170,13 +188,13 @@ function FamilyAddFundPopout({ action, situation, wallet, familyData }) {
return ( return (
<ModalCom action={action} situation={situation}> <ModalCom action={action} situation={situation}>
<div className="relative logout-modal-wrapper lg:w-[500px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl"> <div className="relative logout-modal-wrapper lg:w-[500px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl">
<div className="logout-modal-header w-full flex items-center justify-between lg:px-10 lg:py-8 px-[30px] py-[23px] border-b border-light-purple dark:border-[#5356fb29] "> <div className="modal-header-con">
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide"> <h1 className="modal-title">
Add Fund Add Fund
</h1> </h1>
<button <button
type="button" type="button"
className="text-[#374557] dark:text-red-500" className="modal-close-btn"
onClick={action} onClick={action}
> >
<svg <svg
@@ -271,7 +289,7 @@ function FamilyAddFundPopout({ action, situation, wallet, familyData }) {
<div className="field w-full mb-[0.5rem]"> <div className="field w-full mb-[0.5rem]">
<div className="w-full"> <div className="w-full">
<label <label
htmlFor="Job Delivery Details" htmlFor="job-label"
className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold flex items-center gap-1" className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold flex items-center gap-1"
> >
Comment Comment
+8 -8
View File
@@ -248,13 +248,13 @@ const FamilyForm = ({
}) => { }) => {
return ( return (
<div className="logout-modal-wrapper w-11/12 lg:w-[460px] bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto"> <div className="logout-modal-wrapper w-11/12 lg:w-[460px] bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
<div className="logout-modal-header w-full flex items-center justify-between lg:px-10 lg:py-8 px-[30px] py-[23px] border-b dark:border-[#5356fb29] border-light-purple dark:border-[#5356fb29] "> <div className="modal-header-con">
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide"> <h1 className="modal-title">
Add Members Add Members
</h1> </h1>
<button <button
type="button" type="button"
className="text-[#374557] dark:text-red-500" className="modal-close-btn"
onClick={popUpHandler} onClick={popUpHandler}
> >
<CloseIcon /> <CloseIcon />
@@ -267,8 +267,8 @@ const FamilyForm = ({
name="first_name" name="first_name"
type="text" type="text"
parentClass="flex items-center gap-1 w-full" parentClass="flex items-center gap-1 w-full"
labelClass="flex-[0.2] mb-0" labelClass="flex-[0.4] mb-0"
inputClass="flex-[0.8] input-curve lg border border-[#dce4e9]" inputClass="flex-[0.6] input-curve lg border border-[#dce4e9]"
fieldClass="px-2" fieldClass="px-2"
value={first_name} value={first_name}
inputHandler={inputHandler} inputHandler={inputHandler}
@@ -279,8 +279,8 @@ const FamilyForm = ({
name="last_name" name="last_name"
type="text" type="text"
parentClass="flex items-center gap-1 w-full" parentClass="flex items-center gap-1 w-full"
labelClass="flex-[0.2] mb-0" labelClass="flex-[0.4] mb-0"
inputClass="flex-[0.8] input-curve lg border border-[#dce4e9]" inputClass="flex-[0.6] input-curve lg border border-[#dce4e9]"
fieldClass="px-2" fieldClass="px-2"
value={last_name} value={last_name}
inputHandler={inputHandler} inputHandler={inputHandler}
@@ -289,7 +289,7 @@ const FamilyForm = ({
{/* Age dropdown */} {/* Age dropdown */}
<div className=""> <div className="">
<label <label
className="input-label text-[#181c32] dark:text-white text-[15px] font-semibold" className="job-label"
htmlFor="age-selection" htmlFor="age-selection"
> >
Birthday: (Year/Month) Birthday: (Year/Month)
+5 -5
View File
@@ -89,13 +89,13 @@ export default function AddGroup({ action, situation, setUpdateList }) {
return ( return (
<ModalCom action={action} situation={situation}> <ModalCom action={action} situation={situation}>
<div className="logout-modal-wrapper lg:w-[500px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl"> <div className="logout-modal-wrapper lg:w-[500px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl">
<div className="logout-modal-header w-full flex items-center justify-between lg:px-10 lg:py-8 px-[30px] py-[23px] border-b border-light-purple dark:border-[#5356fb29] "> <div className="modal-header-con">
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide"> <h1 className="modal-title">
Add Group Add Group
</h1> </h1>
<button <button
type="button" type="button"
className="text-[#374557] dark:text-red-500" className="modal-close-btn"
onClick={action} onClick={action}
> >
<svg <svg
@@ -139,9 +139,9 @@ export default function AddGroup({ action, situation, setUpdateList }) {
<button <button
onClick={action} onClick={action}
type="button" type="button"
className="text-base text-light-red tracking-wide " className="w-[152px] h-[46px] flex justify-center items-center rounded-full text-base text-light-red tracking-wide border border-light-red"
> >
<span className="border-b dark:border-[#5356fb29] border-light-red"> <span className="">
Cancel Cancel
</span> </span>
</button> </button>
+3 -3
View File
@@ -21,13 +21,13 @@ export default function DeleteMember({action, situation, details}) {
situation={situation} situation={situation}
> >
<div className="logout-modal-wrapper lg:w-[500px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl"> <div className="logout-modal-wrapper lg:w-[500px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl">
<div className="logout-modal-header w-full flex items-center justify-between lg:px-10 lg:py-8 px-[30px] py-[23px] border-b border-light-purple dark:border-[#5356fb29] "> <div className="modal-header-con">
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide"> <h1 className="modal-title">
Remove Member Remove Member
</h1> </h1>
<button <button
type="button" type="button"
className="text-[#374557] dark:text-red-500" className="modal-close-btn"
onClick={action} onClick={action}
> >
<svg <svg
+5 -3
View File
@@ -229,13 +229,15 @@ export default function MemberList({
// iconName="message" // iconName="message"
/> />
</div> </div>
<div className="input-item w-full"> </div>
<div className="sm:flex gap-2 items-center">
<div className="input-item my-2 w-full sm:w-9/12">
<InputCom <InputCom
labelClass="tracking-wider" labelClass="tracking-wider"
fieldClass="sm:px-6 px-2" fieldClass="sm:px-6 px-2"
value={fields.email} value={fields.email}
inputHandler={handleFieldsChange} inputHandler={handleFieldsChange}
inputClass="xl:w-[16rem] 2xl:w-full" inputClass=""
placeholder="Email" placeholder="Email"
// label="Email" // label="Email"
name="email" name="email"
@@ -243,7 +245,7 @@ export default function MemberList({
// iconName="message" // iconName="message"
/> />
</div> </div>
<div className="flex justify-end items-end"> <div className="flex justify-end items-end w-full sm:w-3/12">
{requestState.loading ? ( {requestState.loading ? (
<LoadingSpinner size="8" color="sky-blue" /> <LoadingSpinner size="8" color="sky-blue" />
) : ( ) : (
+4 -1
View File
@@ -9,6 +9,9 @@ const FamilyWalletBox = lazy(() => import("./FamilyWalletBox"));
const FamilyWalletCon = () => { const FamilyWalletCon = () => {
const apiCall = new usersService(); const apiCall = new usersService();
// const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE // const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE
const {userDetails} = useSelector((state) => state?.userDetails); // GETS USER INFO
const { walletTable } = useSelector((state) => state.tableReload); const { walletTable } = useSelector((state) => state.tableReload);
const [paymentHistory, setPaymentHistory] = useState({ const [paymentHistory, setPaymentHistory] = useState({
@@ -23,7 +26,7 @@ const FamilyWalletCon = () => {
const getFamilyWalletBal = () => { const getFamilyWalletBal = () => {
setFamilyWalletBal({loading:true, data: []}) setFamilyWalletBal({loading:true, data: []})
apiCall.getFamilyWallet({family_uid: localStorage.getItem("uid")}).then(res => { apiCall.getFamilyWallet({family_uid: userDetails.uid}).then(res => {
setFamilyWalletBal({loading:false, data: res?.data?.result_list}) setFamilyWalletBal({loading:false, data: res?.data?.result_list})
}).catch(error => { }).catch(error => {
setFamilyWalletBal({loading:false, data: []}) setFamilyWalletBal({loading:false, data: []})
+13 -1
View File
@@ -1174,7 +1174,7 @@ class usersService {
return this.postAuxEnd("/suggeststatus", postData); return this.postAuxEnd("/suggeststatus", postData);
} }
// FUNCTION TO GET FAMILY WALLET // FUNCTION TO GET FAMILY WALLET AS A KID
getFamilyWallet(reqData) { getFamilyWallet(reqData) {
var postData = { var postData = {
uid: localStorage.getItem("uid"), uid: localStorage.getItem("uid"),
@@ -1186,6 +1186,18 @@ class usersService {
return this.postAuxEnd("/familywallet", postData); return this.postAuxEnd("/familywallet", postData);
} }
// FUNCTION TO GET FAMILY WALLET AS A PARENT
getKidWallets(reqData) {
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
action: apiConst.WRENCHBOARD_FAMILY_WALLET,
...reqData,
};
return this.postAuxEnd("/kidwallets", postData);
}
// FUNCTION TO START FAMILY TRANSFER // FUNCTION TO START FAMILY TRANSFER
familyTransferStart(reqData) { familyTransferStart(reqData) {
var postData = { var postData = {