Skip to content

Commit

Permalink
Merge pull request #77 from labs14-brav/case-overview-user
Browse files Browse the repository at this point in the history
Case overview user
  • Loading branch information
tjforeman authored Aug 26, 2019
2 parents 3343cad + 4c62d3c commit 912029a
Show file tree
Hide file tree
Showing 17 changed files with 1,314 additions and 705 deletions.
32 changes: 32 additions & 0 deletions client/cypress/integration/examples/create-case.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/// <reference types="Cypress" />

context('Create Case', () => {
beforeEach(() => {
cy.visit('https://brav-staging.netlify.com')
})

it('has a case form', () => {
/**
* User Login
*/

cy.get('[data-testid="login-button"]').click()
cy.contains('Sign in with email').click()
cy.get('input[name="email"]').type('[email protected]')
cy.contains('Next').click()
cy.get('input[name="password"]').type('secret')
cy.contains('Sign In').click()
cy.wait(1000)
cy.get('.bravHeader').contains("Brāv")

/**
* View Form
*/

cy.contains('Create a Case').click()
cy.contains('button', 'Non-Court Referral')
cy.contains('button', 'Court Referral').click()
cy.wait(1000)
cy.get('[data-testid="heading-h3"]').contains("Case Form")
})
})
34 changes: 34 additions & 0 deletions client/cypress/integration/examples/search-mediators.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/// <reference types="Cypress" />

context('Search Mediators', () => {
beforeEach(() => {
cy.visit('https://brav-staging.netlify.com')
})

it('has a mediator search', () => {
/**
* User Login
*/

cy.get('[data-testid="login-button"]').click()
cy.contains('Sign in with email').click()
cy.get('input[name="email"]').type('[email protected]')
cy.contains('Next').click()
cy.get('input[name="password"]').type('secret')
cy.contains('Sign In').click()
cy.wait(1000)
cy.get('.bravHeader').contains("Brāv")

/**
* Search mediators
*/

cy.contains('h6', 'Court Case')
cy.contains('button', 'Find a Mediator').click()
cy.contains('h1', 'Search for a Mediator')
cy.get('input[name="specialization"]')
cy.get('input[name="language"]')
cy.get('input[name="price"]')
cy.get('input[name="experience"]')
})
})
18 changes: 18 additions & 0 deletions client/cypress/integration/examples/user-login.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/// <reference types="Cypress" />

context('User Login', () => {
beforeEach(() => {
cy.visit('https://brav-staging.netlify.com')
})

it('has a login form', () => {
cy.get('[data-testid="login-button"]').click()
cy.contains('Sign in with email').click()
cy.get('input[name="email"]').type('[email protected]')
cy.contains('Next').click()
cy.get('input[name="password"]').type('secret')
cy.contains('Sign In').click()
cy.wait(1000)
cy.get('.bravHeader').contains("Brāv")
})
})
31 changes: 31 additions & 0 deletions client/cypress/integration/examples/user-settings.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/// <reference types="Cypress" />

context('Search Mediators', () => {
beforeEach(() => {
cy.visit('https://brav-staging.netlify.com')
})

it('has user settings', () => {
/**
* User Login
*/

cy.get('[data-testid="login-button"]').click()
cy.contains('Sign in with email').click()
cy.get('input[name="email"]').type('[email protected]')
cy.contains('Next').click()
cy.get('input[name="password"]').type('secret')
cy.contains('Sign In').click()
cy.wait(1000)
cy.get('.bravHeader').contains("Brāv")

/**
* User Settings
*/

cy.contains('Settings').click()
cy.contains('h3', 'Site settings')
cy.get('a[href="/users/mediator-registration"]').contains('Become a Mediator')
cy.get('[data-testid="button-deactivate-account"]').contains('Deactivate Account')
})
})
138 changes: 88 additions & 50 deletions client/src/components/MediatorCaseCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Dependencies
*/

import React, { useState, useEffect } from "react";
import moment from 'moment';
import React, { useState } from "react";
import moment from "moment";
import { makeStyles } from "@material-ui/core/styles";
import Card from "@material-ui/core/Card";
import CardActions from "@material-ui/core/CardActions";
Expand All @@ -12,16 +12,16 @@ import Button from "@material-ui/core/Button";
import Modal from "@material-ui/core/Modal";
import AcceptCaseModal from "./modals/AcceptCaseModal";
import DeclineCaseModal from "./modals/DeclineCaseModal";
import CompleteCaseDialog from './modals/CompleteCaseDialog';
import CompleteCaseDialog from "./modals/CompleteCaseDialog";
import InvoiceCaseModal from "./modals/InvoiceCaseModal";
import Dialog from "@material-ui/core/Dialog";
import Toolbar from "@material-ui/core/Toolbar";
import IconButton from "@material-ui/core/IconButton";
import CloseIcon from "@material-ui/icons/Close";
import AddendumsList from "./AddendumsList";
import Typography from "@material-ui/core/Typography";
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faHandshake, faUsers, faClock } from '@fortawesome/free-solid-svg-icons';
import CaseOverviewDialog from "./modals/CaseOverviewDialog";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faHandshake,
faUsers,
faClock
} from "@fortawesome/free-solid-svg-icons";

/**
* Import styles
Expand Down Expand Up @@ -65,25 +65,23 @@ const useStyles = makeStyles(theme => ({
marginBottom: "10px",
paddingBottom: "10px"
},
content:{
display: 'flex',
justifyContent: "space-between",
content: {
display: "flex",
justifyContent: "space-between"
},
court:{
display: 'block',
color: '#5C90C1',
court: {
display: "block",
color: "#5C90C1",
fontWeight: 500,
paddingBottom: '35px',
paddingBottom: "35px"
},
label: {
color: "#5C90C1",
},
info: {

color: "#5C90C1"
},
info: {},
right: {
textAlign: 'end',
},
textAlign: "end"
}
}));

function getModalStyle() {}
Expand All @@ -93,7 +91,6 @@ function getModalStyle() {}
*/

const MediatorCaseCard = props => {
console.log("Mediator Case Card", props)
//created_at: "2019-08-16 16:42:15"
//court_case: 0 or 1

Expand Down Expand Up @@ -124,11 +121,11 @@ const MediatorCaseCard = props => {

const handlecompleteClose = () => {
setCompleteOpen(false);
}
};

const handlecompleteOpen = () => {
setCompleteOpen(true);
}
};
/**
* These two functions are for the text input in the modal
*/
Expand All @@ -137,27 +134,71 @@ const MediatorCaseCard = props => {
setText(e.target.value);
};


const timeStamp = moment(props.case.created_at, "YYYY-MM-DD HH:mm:ss").format(
"MMMM Do YYYY"
);
const timeStamp = moment(
props.case.created_at,
"YYYY-MM-DD HH:mm:ss"
).format("MMMM Do YYYY");

//Need to update link in Mediator-Search link to the proper case ID when possible.
return (
<>
<Card className={classes.cardcontainer}>
<CardContent className={classes.content}>
<div className={classes.left}>
<Typography className={classes.label} variant="overline"> Dispute <FontAwesomeIcon icon={faHandshake} /> Category:</Typography>
<Typography className={classes.info}> {props.case.dispute_category} </Typography>
<Typography className={classes.label} variant="overline">Dispute <FontAwesomeIcon icon={faUsers} /> Participants:</Typography>
<Typography className={classes.info}> {props.case.parties_involved} </Typography>
<Typography
className={classes.label}
variant="overline"
>
{" "}
Dispute <FontAwesomeIcon icon={faHandshake} />{" "}
Category:
</Typography>
<Typography className={classes.info}>
{" "}
{props.case.dispute_category}{" "}
</Typography>
<Typography
className={classes.label}
variant="overline"
>
Dispute <FontAwesomeIcon icon={faUsers} />{" "}
Participants:
</Typography>
<Typography className={classes.info}>
{" "}
{`${props.case.case_initiator}, ${
props.case.parties_involved
}`}
</Typography>
</div>
<div className={classes.right}>
{props.case.court_case === 1 ? <Typography variant="overline" className={classes.court}> Court Case </Typography> : <Typography variant="overline" className={classes.court}> Non-Court Case </Typography>}
<Typography className={classes.label} variant="overline"> Case <FontAwesomeIcon icon={faClock} /> Created:</Typography>
<Typography className={classes.info}>{timeStamp}</Typography>

{props.case.court_case === 1 ? (
<Typography
variant="overline"
className={classes.court}
>
{" "}
Court Case{" "}
</Typography>
) : (
<Typography
variant="overline"
className={classes.court}
>
{" "}
Non-Court Case{" "}
</Typography>
)}
<Typography
className={classes.label}
variant="overline"
>
{" "}
Case <FontAwesomeIcon icon={faClock} /> Created:
</Typography>
<Typography className={classes.info}>
{timeStamp}
</Typography>
</div>
</CardContent>
<CardActions className={classes.actions}>
Expand All @@ -182,7 +223,7 @@ const MediatorCaseCard = props => {
{props.case.case_accepted_at &&
props.case.case_declined_at === null &&
props.case.case_completed_at === null ? (
<Button onClick={handlecompleteOpen} >
<Button onClick={handlecompleteOpen}>
Complete Case
</Button>
) : null}
Expand Down Expand Up @@ -226,21 +267,18 @@ const MediatorCaseCard = props => {
</div>
</Modal>


<CompleteCaseDialog
open={completeopen}
onClose={handlecompleteClose}
caseId={props.case.id} />

<Dialog fullScreen open={fullopen} onClose={handlefullClose}>
<Toolbar>
<IconButton edge="end" onClick={handlefullClose}>
<CloseIcon />
</IconButton>
</Toolbar>
<AddendumsList case={props.case} />
</Dialog>
caseId={props.case.id}
/>

<CaseOverviewDialog
case={props.case}
open={fullopen}
handleClose={handlefullClose}
fetchCases={props.fetchCases}
/>
</>
);
};
Expand Down
3 changes: 1 addition & 2 deletions client/src/components/UserCaseCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ const useStyles = makeStyles(theme => ({
*/

const UserCaseCard = (props) => {
// console.log("Case Props", props);
const [fullopen, setFullOpen] = useState(false);
const classes = useStyles();

Expand All @@ -109,7 +108,7 @@ const UserCaseCard = (props) => {
}


if(props.case.court_case === 1) {
if(props.case.court_case === 1 || props.case.court_case === true || props.case.court_case === 'true') {

return (
<>
Expand Down
Loading

0 comments on commit 912029a

Please sign in to comment.