Rahat Agency App
diff --git a/src/modules/authentication/wallet.css b/src/modules/authentication/wallet.css
index 5bc6ddab..ce3d922f 100644
--- a/src/modules/authentication/wallet.css
+++ b/src/modules/authentication/wallet.css
@@ -45,6 +45,11 @@
color: #fff;
font-size: 14px;
}
+.text-subheader {
+ color: #fff;
+ font-size: 16px;
+ text-align: left;
+}
.text-tutorial {
color: #3f9eeb;
font-size: 14px;
diff --git a/src/modules/beneficary/add/add.js b/src/modules/beneficary/add/add.js
index 1d565d6a..42c32f10 100644
--- a/src/modules/beneficary/add/add.js
+++ b/src/modules/beneficary/add/add.js
@@ -12,7 +12,7 @@ import { blobToBase64 } from '../../../utils';
const Add = () => {
const { addToast } = useToasts();
- const { listAid, addBeneficiary } = useContext(BeneficiaryContext);
+ const { listProject, addBeneficiary } = useContext(BeneficiaryContext);
const [formData, setFormData] = useState({
name: '',
@@ -96,7 +96,7 @@ const Add = () => {
const handleCancelClick = () => History.push('/beneficiaries');
const loadProjects = useCallback(async () => {
- const projects = await listAid();
+ const projects = await listProject();
if (projects && projects.data.length) {
const select_options = projects.data.map(p => {
return {
@@ -106,7 +106,7 @@ const Add = () => {
});
setProjectList(select_options);
}
- }, [listAid]);
+ }, [listProject]);
useEffect(() => {
loadProjects();
@@ -179,13 +179,13 @@ const Add = () => {
-
+
-
+
diff --git a/src/modules/beneficary/detail/beneficiaryInfo.js b/src/modules/beneficary/detail/beneficiaryInfo.js
index e921cd8e..99407cca 100644
--- a/src/modules/beneficary/detail/beneficiaryInfo.js
+++ b/src/modules/beneficary/detail/beneficiaryInfo.js
@@ -5,6 +5,7 @@ import '../../../assets/css/project.css';
import IdImgPlaceholder from '../../../assets/images/id-icon-1.png';
import { formatWord } from '../../../utils';
import { History } from '../../../utils/History';
+import moment from 'moment';
const IPFS_GATEWAY = process.env.REACT_APP_IPFS_GATEWAY;
@@ -36,6 +37,10 @@ export default function BeneficiaryInfo({ basicInfo, extras }) {
{basicInfo.address || '-'}
Address
+
+
{extras && extras.education ? extras.education : '-'}
+
Education
+
{basicInfo.govt_id || '-'}
Government ID number
@@ -51,8 +56,12 @@ export default function BeneficiaryInfo({ basicInfo, extras }) {
-
{extras && extras.education ? extras.education : '-'}
-
Education
+
{basicInfo.phone || '-'}
+
Phone
+
+
+
{extras && extras.profession ? extras.profession : '-'}
+
Profession
{basicInfo.gender || '-'}
@@ -66,12 +75,9 @@ export default function BeneficiaryInfo({ basicInfo, extras }) {
{extras && extras.child ? extras.child : '-'}
Number of family member(Child)
+
-
-
{extras && extras.profession ? extras.profession : '-'}
-
Profession
-
+
+
{ moment(extras.created_at).format('MMM Do YYYY, hh:mm A') || '-'}
+
Registration Date
+
diff --git a/src/modules/beneficary/detail/detail.js b/src/modules/beneficary/detail/detail.js
index 52977051..46a771a6 100644
--- a/src/modules/beneficary/detail/detail.js
+++ b/src/modules/beneficary/detail/detail.js
@@ -78,6 +78,7 @@ const BenefDetails = ({ params }) => {
setAssignTokenAmount('');
let newWindow = window.open('', 'Print QR', 'fullscreen=yes'),
document = newWindow.document.open();
+ console.log({newWindow});
document.write(html);
document.close();
setTimeout(function () {
diff --git a/src/modules/beneficary/edit/edit.js b/src/modules/beneficary/edit/edit.js
index a57aff2f..a7957c44 100644
--- a/src/modules/beneficary/edit/edit.js
+++ b/src/modules/beneficary/edit/edit.js
@@ -14,7 +14,7 @@ const IPFS_GATEWAY = process.env.REACT_APP_IPFS_GATEWAY;
const Edit = ({ beneficiaryId }) => {
const { addToast } = useToasts();
- const { listAid, updateBeneficiary, getBeneficiaryDetails } = useContext(BeneficiaryContext);
+ const { listProject, updateBeneficiary, getBeneficiaryDetails } = useContext(BeneficiaryContext);
const [formData, setFormData] = useState({
name: '',
@@ -60,6 +60,7 @@ const Edit = ({ beneficiaryId }) => {
};
const handleInputChange = e => {
+ console.log('event', e.target.name, e.target.value);
setFormData({ ...formData, [e.target.name]: e.target.value });
};
@@ -125,19 +126,19 @@ const Edit = ({ beneficiaryId }) => {
}
setExtras(extras);
if (extras.group) setSelectedGroup(extras.group);
- delete d.extras;
+ // delete d.extras;
setFormData({ name, phone, email, address, address_temporary, govt_id });
const { gender } = d;
if (gender !== 'U') setSelectedGender(gender);
- }, [beneficiaryId, getBeneficiaryDetails]);
+ }, [getBeneficiaryDetails, beneficiaryId]);
const loadProjects = useCallback(async () => {
- const projects = await listAid();
+ const projects = await listProject();
if (projects && projects.data.length) {
const select_options = createProjectSelectOptions(projects.data);
setProjectList(select_options);
}
- }, [listAid]);
+ }, [listProject]);
useEffect(() => {
loadProjects();
diff --git a/src/modules/beneficary/list.js b/src/modules/beneficary/list.js
index e1e31d6f..ec2f68ae 100644
--- a/src/modules/beneficary/list.js
+++ b/src/modules/beneficary/list.js
@@ -18,6 +18,8 @@ import {
} from 'reactstrap';
import displayPic from '../../assets/images/users/user_avatar.svg';
import { History } from '../../utils/History';
+import moment from 'moment';
+
const searchOptions = { PHONE: 'phone', NAME: 'name', PROJECT: 'project' };
@@ -30,7 +32,8 @@ const Beneficiary = () => {
});
const [selectedProject, setSelectedProject] = useState('');
- const { listBeneficiary, list, pagination, listAid, projectList } = useContext(BeneficiaryContext);
+
+ const { listBeneficiary, list, pagination, listProject, projectList } = useContext(BeneficiaryContext);
const handleFilterChange = e => {
let { value } = e.target;
@@ -83,8 +86,9 @@ const Beneficiary = () => {
});
};
+
const fetchProjectList = () => {
- listAid()
+ listProject()
.then()
.catch(() => {
addToast('Something went wrong!', {
@@ -179,7 +183,7 @@ const Beneficiary = () => {
Name |
Phone |
Address |
-
Govt. ID |
+
Registration Date |
Action |
@@ -202,7 +206,7 @@ const Beneficiary = () => {
{d.phone} |
{d.address} |
-
{d.govt_id ? d.govt_id : '-'} |
+
{moment(d.created_at).format('MMM Do YYYY, hh:mm A')} |
diff --git a/src/modules/dashboard/Dashboard.js b/src/modules/dashboard/Dashboard.js
index ba388340..c0909da6 100644
--- a/src/modules/dashboard/Dashboard.js
+++ b/src/modules/dashboard/Dashboard.js
@@ -1,13 +1,12 @@
import React, { useContext, useState, useEffect } from 'react';
import { Row, Col } from 'reactstrap';
import { useToasts } from 'react-toast-notifications';
-
import TokenByProject from './tokens_by_project';
import BeneficiaryByProject from './beneficiary_by_project';
import { StatsCard } from '../ui_components/cards';
import { TOAST } from '../../constants';
-
import { UserContext } from '../../contexts/UserContext';
+import TransactionChart from '../ui_components/chart';
const Dashboard = () => {
const { addToast } = useToasts();
@@ -127,6 +126,7 @@ const Dashboard = () => {
/>
+
>
);
};
diff --git a/src/modules/global/LiteModal.js b/src/modules/global/LiteModal.js
index e6f432e9..e5e5ab8c 100644
--- a/src/modules/global/LiteModal.js
+++ b/src/modules/global/LiteModal.js
@@ -1,28 +1,37 @@
-import React, { useState } from 'react';
-import { Form, Modal, ModalBody,ModalHeader } from 'reactstrap';
+import React from // ,{ useState }
+'react';
+import { Form, Modal, ModalBody, ModalHeader } from 'reactstrap';
import PropTypes from 'prop-types';
-import useDigitInput from 'react-digit-input';
+// import useDigitInput from 'react-digit-input';
export default function CustomModal(props) {
- const { children,toggle, title, loadingMessage, open, size, handleSubmit } = props;
- const [value, onChange] = useState('');
- const digits = useDigitInput({
- acceptedCharacters: /^[0-9]$/,
- length: 6,
- value,
- onChange
- });
+ const {
+ children,
+ // toggle,
+ title,
+ loadingMessage,
+ open,
+ size,
+ handleSubmit
+ } = props;
+ // const [value, onChange] = useState('');
+ // const digits = useDigitInput({
+ // acceptedCharacters: /^[0-9]$/,
+ // length: 6,
+ // value,
+ // onChange
+ // });
return (
<>
-
-
-
+
+
+
>
);
}
diff --git a/src/modules/global/PasscodeModal.js b/src/modules/global/PasscodeModal.js
index 6dca1edc..e8d72406 100644
--- a/src/modules/global/PasscodeModal.js
+++ b/src/modules/global/PasscodeModal.js
@@ -32,7 +32,7 @@ export default function PasscodeModal(props) {
changeIsverified(true);
setLoadingMessage('Wallet verified!');
} else {
- setLoadingMessage('Verifying wallet, please wallet...');
+ setLoadingMessage('Verifying wallet, please wait...');
const w = await Wallet.loadWallet(input_value);
setWalletPasscode(input_value);
changeIsverified(true);
@@ -68,7 +68,7 @@ export default function PasscodeModal(props) {
{/* {children || 'No child elements supplied.'} */}
{/* Close */}
-
+
{title || 'Verify Passcode'}
@@ -78,6 +78,10 @@ export default function PasscodeModal(props) {
+
+ Enter you passcode from RUMSAN WALLET to proceed transaction
+
+
diff --git a/src/modules/mobilizer/add/add.js b/src/modules/mobilizer/add/add.js
new file mode 100644
index 00000000..7b3c0018
--- /dev/null
+++ b/src/modules/mobilizer/add/add.js
@@ -0,0 +1,175 @@
+import React, { useState, useContext } from 'react';
+import { Card, CardBody, Row, Col, Form, FormGroup, Label, Input, Button } from 'reactstrap';
+import { useToasts } from 'react-toast-notifications';
+import { MobilizerContext } from '../../../contexts/MobilizerContext';
+import { History } from '../../../utils/History';
+import { TOAST } from '../../../constants';
+import WalletUnlock from '../../../modules/global/walletUnlock';
+import { blobToBase64 } from '../../../utils';
+import AvatarIcon from '../../../assets/images/download.png';
+import BreadCrumb from '../../ui_components/breadcrumb';
+
+const Add = () => {
+ const { addToast } = useToasts();
+ const { addMobilizer } = useContext(MobilizerContext);
+ const [passcodeModal, setPasscodeModal] = useState(false);
+ const [formData, setFormData] = useState({
+ name: '',
+ phone: '',
+ email: '',
+ address: '',
+ organization: '',
+ wallet_address: ''
+ });
+ const [loading, setLoading] = useState(false);
+ const [govtIdImg, setGovtIdImg] = useState('');
+ const [profileUpload, setProfileUpload] = useState('');
+
+ const handleInputChange = e => {
+ setFormData({ ...formData, [e.target.name]: e.target.value });
+ };
+
+ async function handleProfileUpload(e) {
+ const base64Url = await blobToBase64(e.target.files[0]);
+ setProfileUpload(base64Url);
+ }
+
+ async function handleGovtIdImage(e) {
+ const base64Url = await blobToBase64(e.target.files[0]);
+ setGovtIdImg(base64Url);
+ }
+ const handleFormSubmit = e => {
+ e.preventDefault();
+ const payload = { ...formData };
+ if (profileUpload) payload.photo = profileUpload;
+ if (govtIdImg) payload.govt_id_image = govtIdImg;
+ setLoading(true);
+ addMobilizer(payload)
+ .then(() => {
+ setLoading(false);
+ addToast('Mobilizer added successfully', TOAST.SUCCESS);
+ History.push('/mobilizers');
+ })
+ .catch(err => {
+ setLoading(false);
+ addToast(err.message, TOAST.ERROR);
+ });
+ };
+
+ const handleCancelClick = () => History.push('/users');
+
+ return (
+
+ setPasscodeModal(e)}>
+ Mobilizers
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default Add;
diff --git a/src/modules/mobilizer/add/index.js b/src/modules/mobilizer/add/index.js
new file mode 100644
index 00000000..fa188267
--- /dev/null
+++ b/src/modules/mobilizer/add/index.js
@@ -0,0 +1,13 @@
+import React from 'react';
+import { MobilizerContextProvider } from '../../../contexts/MobilizerContext';
+import AddMobilizer from './add';
+
+const index = () => {
+ return (
+
+
+
+ );
+};
+
+export default index;
diff --git a/src/modules/mobilizer/detail/detail.js b/src/modules/mobilizer/detail/detail.js
index cafc7810..4f7697d3 100644
--- a/src/modules/mobilizer/detail/detail.js
+++ b/src/modules/mobilizer/detail/detail.js
@@ -2,22 +2,37 @@ import React, { useContext, useEffect, useState } from 'react';
import { useToasts } from 'react-toast-notifications';
import Select from 'react-select';
import { Link } from 'react-router-dom';
-
-import { Card,
- CardBody, Row, Col, Input, ButtonGroup, Button, Table, CardSubtitle, CardTitle,Label,FormGroup,
- InputGroup,
+import Loading from '../../global/Loading';
+import ProjectInvovled from '../../ui_components/projects';
+
+import {
+ Card,
+ CardBody,
+ Row,
+ Col,
+ // Input,
+ // ButtonGroup,
+ Button,
+ Table,
+ CardSubtitle,
+ CardTitle,
+ Label,
+ FormGroup,
Modal,
ModalBody,
ModalHeader,
- ModalFooter } from 'reactstrap';
-import Swal from 'sweetalert2';
+ ModalFooter
+} from 'reactstrap';
+// import Swal from 'sweetalert2';
import { MobilizerContext } from '../../../contexts/MobilizerContext';
import { AppContext } from '../../../contexts/AppSettingsContext';
import profilePhoto from '../../../assets/images/users/user_avatar.svg';
-import IdPhoto from '../../../assets/images/id-icon-1.png';
-import UnlockWallet from '../../global/walletUnlock';
-import Loading from '../../global/Loading';
+// import IdPhoto from '../../../assets/images/id-icon-1.png';
+// import UnlockWallet from '../../global/walletUnlock';
+import PasscodeModal from '../../global/PasscodeModal';
+import MobilizerInfo from './mobilizerInfo';
+import BreadCrumb from '../../ui_components/breadcrumb';
const EXPLORER_URL = process.env.REACT_APP_BLOCKCHAIN_EXPLORER;
const IPFS_GATEWAY = process.env.REACT_APP_IPFS_GATEWAY;
@@ -29,12 +44,12 @@ export default function DetailsForm(props) {
mobilizer,
getMobilizerDetails,
approveMobilizer,
- changeMobilizerStatus,
+ // changeMobilizerStatus,
getMobilizerBalance,
getMobilizerTransactions,
transactionHistory,
getAvailableBalance,
- listAid,
+ listAid
} = useContext(MobilizerContext);
const { appSettings, isVerified, changeIsverified } = useContext(AppContext);
const [mobilizerBalance, setMobilizerBalance] = useState('');
@@ -43,17 +58,25 @@ export default function DetailsForm(props) {
const togglePasscodeModal = () => setPasscodeModal(!passcodeModal);
const [modal, setModal] = useState(false);
const [projectOptions, setProjectOptions] = useState([]);
- const [inputTokens, setInputTokens] = useState(null);
+ // const [inputTokens, setInputTokens] = useState(null);
const [selectedProject, setSelectedProject] = useState('');
const [availableBalance, setAvailableBalance] = useState(null);
const [showAlert, setShowAlert] = useState(false);
-
+ const [fetchingBalance, setFetchingBalance] = useState(false);
+ const [projectList, setProjectList] = useState([]);
const loadMobilizerDetails = () => {
getMobilizerDetails(mobilizerId)
.then(d => {
getMobilizerTransactions(mobilizerId);
getBalance(d.wallet_address);
+
+ if (d.projects && d.projects.length) {
+ const projects = d.projects.map(d => {
+ return { id: d._id, name: d.name };
+ });
+ setProjectList(projects);
+ }
})
.catch(() => {
addToast('Something went wrong on server!', {
@@ -66,9 +89,12 @@ export default function DetailsForm(props) {
const getBalance = async wallet => {
if (appSettings && appSettings.agency) {
try {
+ setFetchingBalance(true);
+
const { token } = appSettings.agency.contracts;
let d = await getMobilizerBalance(token, wallet);
setMobilizerBalance(d);
+ setFetchingBalance(false);
} catch {
addToast('Invalid Mobilizer wallet address!', {
appearance: 'error',
@@ -78,36 +104,35 @@ export default function DetailsForm(props) {
}
};
- const handleChangeStatus = async status => {
- let swal = await Swal.fire({
- title: 'Are you sure?',
- text: `Mobilizer will be marked as ${status}`,
- icon: 'warning',
- showCancelButton: true,
- confirmButtonColor: '#3085d6',
- cancelButtonColor: '#d33',
- confirmButtonText: 'Yes'
- });
- if (swal.isConfirmed) {
- try {
- await changeMobilizerStatus(mobilizerId, status);
- addToast(`Mobilizer marked as ${status}`, {
- appearance: 'success',
- autoDismiss: true
- });
- } catch (e) {
- addToast('Something went wrong on server!', {
- appearance: 'error',
- autoDismiss: true
- });
- }
- }
- };
-
- const handleTokenChange = e => {
- setInputTokens(e.target.value);
- };
-
+ // const handleChangeStatus = async status => {
+ // let swal = await Swal.fire({
+ // title: 'Are you sure?',
+ // text: `Mobilizer will be marked as ${status}`,
+ // icon: 'warning',
+ // showCancelButton: true,
+ // confirmButtonColor: '#3085d6',
+ // cancelButtonColor: '#d33',
+ // confirmButtonText: 'Yes'
+ // });
+ // if (swal.isConfirmed) {
+ // try {
+ // await changeMobilizerStatus(mobilizerId, status);
+ // addToast(`Mobilizer marked as ${status}`, {
+ // appearance: 'success',
+ // autoDismiss: true
+ // });
+ // } catch (e) {
+ // addToast('Something went wrong on server!', {
+ // appearance: 'error',
+ // autoDismiss: true
+ // });
+ // }
+ // }
+ // };
+
+ // const handleTokenChange = e => {
+ // setInputTokens(e.target.value);
+ // };
const handleSelectProject = async e => {
try {
@@ -163,12 +188,11 @@ export default function DetailsForm(props) {
};
const resetTokenIssueForm = () => {
- setInputTokens(null);
+ // setInputTokens(null);
setAvailableBalance('');
setShowAlert(false);
};
-
const handleMobilizerApprove = async e => {
e.preventDefault();
// let swal = await Swal.fire({
@@ -180,12 +204,11 @@ export default function DetailsForm(props) {
// cancelButtonColor: '#d33',
// confirmButtonText: 'Yes'
// });
- // if (swal.isConfirmed)
+ // if (swal.isConfirmed)
toggleModal();
togglePasscodeModal();
};
-
const fetchProjectList = () => {
listAid()
.then(d => {
@@ -223,10 +246,12 @@ export default function DetailsForm(props) {
return (
<>
- setPasscodeModal(e)}>
-
+
+ Mobilizers
+
+ {/* setPasscodeModal(e)}> */}
Issue Token
@@ -241,7 +266,6 @@ export default function DetailsForm(props) {
placeholder="--Select Project--"
/>
-
{showAlert && availableBalance > 0 ? (
@@ -262,24 +286,99 @@ export default function DetailsForm(props) {
-
-
- <>
-
-
- >
-
-
+ <>
+
+
+ >
-
-
+
+
+
+
+ Mobilizer Detail
+
+
+
+
+
+
+
+ {mobilizer ? mobilizer.name : ''}
+ Name
+
+
+
+
+ {loading ? (
+
+ ) : mobilizer_status === 'active' ? (
+
+ ) : (
+
+ )}
+
+
+
+
+
+
+
+
+ Token
+
+
+ {fetchingBalance ? : {mobilizerBalance || 0} }
+
+ Total Balance
+
+
+ 0
+ Total Redeemed
+
+
+
+
+
+
+
+
+
+ {/*
@@ -428,7 +527,7 @@ export default function DetailsForm(props) {
-
+ */}
diff --git a/src/modules/mobilizer/detail/mobilizerInfo.js b/src/modules/mobilizer/detail/mobilizerInfo.js
new file mode 100644
index 00000000..b8100604
--- /dev/null
+++ b/src/modules/mobilizer/detail/mobilizerInfo.js
@@ -0,0 +1,83 @@
+import React from 'react';
+import { Card, CardTitle, Col, Row } from 'reactstrap';
+import '../../../assets/css/project.css';
+import image from '../../../assets/images/id-icon-1.png';
+import { History } from '../../../utils/History';
+import moment from 'moment'
+const IPFS_GATEWAY = process.env.REACT_APP_IPFS_GATEWAY;
+
+export default function MobilizerInfo(props) {
+ const { information } = props;
+ const { id } = props.information;
+ const handleEditClick = () => History.push(`/edit-mobilizer/${id}`);
+ return (
+
+
+
+
+
+ More Information
+
+
+
+
+
+
+
+
+ {information.email || '-'}
+ Email
+
+
+ {information.bank_name || '-'}
+ Government ID
+
+
+ {information.wallet_address || '-'}
+ Wallet address
+
+
+
+
+ {information.phone || '-'}
+ Phone number
+
+
+ {information.address || '-'}
+ Address
+
+
+ {information.organization || '-'}
+ Organization
+
+
+
+
+
+ { moment(information.created_at).format('MMM Do YYYY, hh:mm A') || '-'}
+ Registration Date
+
+
+
+
+
+
+ );
+}
diff --git a/src/modules/mobilizer/edit/edit.js b/src/modules/mobilizer/edit/edit.js
new file mode 100644
index 00000000..69ef6425
--- /dev/null
+++ b/src/modules/mobilizer/edit/edit.js
@@ -0,0 +1,221 @@
+import React, { useState, useEffect, useContext, useCallback } from 'react';
+import { Card, CardBody, Row, Col, Form, FormGroup, Label, Input, Button } from 'reactstrap';
+import { useToasts } from 'react-toast-notifications';
+import { MobilizerContext } from '../../../contexts/MobilizerContext';
+import { History } from '../../../utils/History';
+import { TOAST } from '../../../constants';
+import WalletUnlock from '../../../modules/global/walletUnlock';
+import AvatarIcon from '../../../assets/images/download.png';
+import { blobToBase64 } from '../../../utils';
+import BreadCrumb from '../../ui_components/breadcrumb';
+
+const IPFS_GATEWAY = process.env.REACT_APP_IPFS_GATEWAY;
+
+const Edit = ({ mobilizerId }) => {
+ const { addToast } = useToasts();
+ const { updateMobilizer, getMobilizerDetails } = useContext(MobilizerContext);
+ const [passcodeModal, setPasscodeModal] = useState(false);
+ const [loading, setLoading] = useState(false);
+ const [formData, setFormData] = useState({
+ name: '',
+ phone: '',
+ email: '',
+ address: '',
+ wallet_address: '',
+ organization: ''
+ });
+
+ const [govtIdentity, setGovtIdentity] = useState('');
+ const [profileUpload, setProfileUpload] = useState('');
+ const [existingProfilePhoto, setExistingProfilePhoto] = useState('');
+ const [existingIdentity, setExistingIdentity] = useState('');
+
+ const handleInputChange = e => {
+ setFormData({ ...formData, [e.target.name]: e.target.value });
+ };
+ const handleCancelClick = () => History.push('/mobilizers');
+
+ async function handleProfileUpload(e) {
+ const base64Url = await blobToBase64(e.target.files[0]);
+ setProfileUpload(base64Url);
+ }
+
+ async function handleGovtIdentity(e) {
+ const base64Url = await blobToBase64(e.target.files[0]);
+ setGovtIdentity(base64Url);
+ }
+
+ const handleFormSubmit = e => {
+ e.preventDefault();
+ console.log('form data', formData);
+ const payload = { ...formData };
+ if (profileUpload) payload.photo = profileUpload;
+ if (govtIdentity) payload.govt_id_image = govtIdentity;
+
+ setLoading(true);
+ updateMobilizer(mobilizerId, payload)
+ .then(() => {
+ setLoading(false);
+ addToast('Mobilizer updated successfully', TOAST.SUCCESS);
+ History.push('/mobilizers');
+ })
+ .catch(err => {
+ setLoading(false);
+ addToast(err.message, TOAST.ERROR);
+ });
+ };
+
+ const loadMobilizersDetails = useCallback(async () => {
+ const d = await getMobilizerDetails(mobilizerId);
+ const { name, phone, email, address, wallet_address, organization, photo, govt_id_image } = d;
+
+ if (photo && photo.length) setExistingProfilePhoto(photo[0]);
+ if (govt_id_image) setExistingIdentity(govt_id_image);
+ setFormData({
+ name,
+ phone,
+ email,
+ address,
+ wallet_address,
+ organization
+ });
+ }, [getMobilizerDetails, mobilizerId]);
+
+ useEffect(() => {
+ loadMobilizersDetails();
+ }, [loadMobilizersDetails]);
+
+ return (
+
+ setPasscodeModal(e)}>
+ Mobilizers
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default Edit;
diff --git a/src/modules/mobilizer/edit/index.js b/src/modules/mobilizer/edit/index.js
new file mode 100644
index 00000000..01be37b5
--- /dev/null
+++ b/src/modules/mobilizer/edit/index.js
@@ -0,0 +1,14 @@
+import React from 'react';
+import { MobilizerContextProvider } from '../../../contexts/MobilizerContext';
+import EditVendor from './edit';
+
+export default function Index({ match }) {
+ const { id } = match.params;
+ return (
+ <>
+
+
+
+ >
+ );
+}
diff --git a/src/modules/mobilizer/list.js b/src/modules/mobilizer/list.js
index 4989cdcd..ba670d37 100644
--- a/src/modules/mobilizer/list.js
+++ b/src/modules/mobilizer/list.js
@@ -2,6 +2,9 @@ import React, { useState, useEffect, useContext } from 'react';
import { MobilizerContext } from '../../contexts/MobilizerContext';
import { useToasts } from 'react-toast-notifications';
import { Link } from 'react-router-dom';
+import { History } from '../../utils/History';
+import moment from 'moment';
+
import {
Card,
@@ -40,9 +43,7 @@ const Mobilizer = () => {
const toggle = () => setModel(!model);
const fetchList = query => {
- console.log('LSIISHD');
- let params = { ...pagination, ...query };
- console.log({ params });
+ let params = { start:pagination.start,limit:pagination.limit, ...query };
listMobilizer(params)
.then()
.catch(() => {
@@ -88,6 +89,8 @@ const Mobilizer = () => {
return fetchList({ start: _start, limit: pagination.limit });
};
+ const handleAddClick = () => History.push('/add-mobilizers');
+
return (
@@ -108,7 +111,7 @@ const Mobilizer = () => {
name="customSelect"
defaultValue=""
onChange={handleFilterChange}
- style={{ width: 'auto' }}
+ style={{ width: 'auto', marginRight: '5px' }}
>
@@ -124,7 +127,7 @@ const Mobilizer = () => {
-
@@ -135,15 +138,18 @@ const Mobilizer = () => {
+ S.N. |
Name |
Phone |
Address |
+ Registration Date |
Action |
{list.length ? (
list.map((e, i) => (
+
{(pagination.currentPage - 1) * pagination.limit + i + 1} |
@@ -159,9 +165,10 @@ const Mobilizer = () => {
|
{e.phone} |
{e.address} |
-
-
- Details
+ | {moment(e.created_at).format('MMM Do YYYY, hh:mm A')} |
+
+
+
|
diff --git a/src/modules/ui_components/chart/index.js b/src/modules/ui_components/chart/index.js
new file mode 100644
index 00000000..0aa09f01
--- /dev/null
+++ b/src/modules/ui_components/chart/index.js
@@ -0,0 +1,95 @@
+import React from 'react';
+import { Card, CardTitle } from 'reactstrap';
+import '../../../assets/css/project.css';
+import Chart from 'react-apexcharts';
+// import Loading from '../../global/Loading';
+
+//Line chart
+const optionssalesummary = {
+ chart: {
+ id: 'basic-bar',
+ type: 'area',
+ toolbar: {
+ show: false
+ }
+ },
+
+ dataLabels: {
+ enabled: false
+ },
+ stroke: {
+ curve: 'smooth',
+ width: 2
+ },
+ colors: ['#4fc3f7', '#7460ee'],
+ legend: {
+ show: false
+ },
+ markers: {
+ size: 3
+ },
+ xaxis: {
+ categories: [1, 2, 3, 4, 5, 6, 7, 8, 9],
+ labels: {
+ show: true,
+ style: {
+ colors: ['#99abb4', '#99abb4', '#99abb4', '#99abb4', '#99abb4', '#99abb4', '#99abb4', '#99abb4'],
+ fontSize: '12px',
+ fontFamily: "'Nunito Sans', sans-serif"
+ }
+ }
+ },
+ yaxis: {
+ labels: {
+ show: true,
+ style: {
+ colors: ['#99abb4', '#99abb4', '#99abb4', '#99abb4', '#99abb4', '#99abb4', '#99abb4', '#99abb4'],
+ fontSize: '12px',
+ fontFamily: "'Nunito Sans', sans-serif"
+ }
+ }
+ },
+ grid: {
+ borderColor: 'rgba(0,0,0,0.1)',
+ xaxis: {
+ lines: {
+ show: true
+ }
+ },
+ yaxis: {
+ lines: {
+ show: true
+ }
+ }
+ },
+ tooltip: {
+ theme: 'dark'
+ }
+};
+const seriessalessummry = [
+ {
+ name: 'Site A view',
+ data: [0, 5, 6, 8, 25, 9, 8, 24]
+ },
+ {
+ name: 'Site B view',
+ data: [0, 3, 1, 2, 8, 1, 5, 1]
+ }
+];
+
+export default function TransactionChart() {
+ return (
+
+ );
+}
diff --git a/src/modules/user/edit/index.js b/src/modules/user/edit/index.js
index c1c39fb7..2f988963 100644
--- a/src/modules/user/edit/index.js
+++ b/src/modules/user/edit/index.js
@@ -1,6 +1,6 @@
import React, { useCallback, useState, useContext, useEffect } from 'react';
import { useToasts } from 'react-toast-notifications';
-import { Card, CardBody, CardTitle, Row, Col, Form, FormGroup, Label, Input, Button } from 'reactstrap';
+import { Card, CardBody, CardTitle,CardSubtitle, Row, Col, Form, FormGroup, Label, Input, Button } from 'reactstrap';
import { TOAST, ROLES } from '../../../constants';
import { UserContext } from '../../../contexts/UserContext';
@@ -90,11 +90,11 @@ const UserDetails = props => {
};
const sanitizeAndSetRoles = roles => {
+ if(!roles) return;
let data = roles.map(d => {
return { label: d, value: d };
});
- if (data.length > 1) data = data.filter(f => f.value === ROLES.ADMIN);
-
+ //if (data.length > 1) data = data.filter(f => f.value === ROLES.ADMIN);
setExsitingRoles(data);
};
@@ -214,23 +214,29 @@ const UserDetails = props => {
User Roles
+ {existingRoles.length > 0 ?(
+ existingRoles.map((roles)=>{
+ return {roles.label}
+ })
+ ):(
+ ''
+ )}
|