forked from Ada-C12/video-store-consumer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from krismosk/ktm
Ktm
- Loading branch information
Showing
9 changed files
with
106 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
.movie-img { | ||
width: 50%; | ||
height: 50%; | ||
} | ||
|
||
.MovieCard { | ||
display: flex; | ||
border: solid 2px black; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,5 @@ | ||
.RentalCard { | ||
display: flex; | ||
border: solid 2px black; | ||
margin: 5px; | ||
border-radius: 10px; | ||
} | ||
|
||
.button { | ||
float: right; | ||
width: 100px; | ||
background: #0099FF; | ||
border: 1px solid black; | ||
padding: 10px; | ||
font-weight: bold; | ||
font-size: 1.1em; | ||
color: white; | ||
border-radius: 10px; | ||
margin: 10px; | ||
.rental-card { | ||
padding: 5%; | ||
padding-left: 15%; | ||
padding-right: 15%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,38 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import './RentalCard.css'; | ||
|
||
const RentalCard = ({ rentalId, movieTitle, customerId, customerName, checkoutDate, dueDate, checkinRental }) => { | ||
|
||
let date = new Date(); | ||
date = date.toISOString(); | ||
date = date.split('T')[0]; | ||
|
||
const overdueFormatting = dueDate < date ? <p className="badge badge-danger">OVERDUE</p> : ""; | ||
|
||
return ( | ||
<div> | ||
<section className="RentalCard"> | ||
<p>Title: { movieTitle }</p> | ||
<p>Customer: { customerName }</p> | ||
<p>Checkout date: { checkoutDate } </p> | ||
<p>Due date: { dueDate }</p> | ||
</section> | ||
<button onClick={() => {checkinRental(customerId, movieTitle, rentalId)}} type="button">Check in Rental</button> | ||
<div className="card-deck rental-card"> | ||
<div className="card bg-light"> | ||
<div className="card-body"> | ||
{ overdueFormatting } | ||
<p>Title: { movieTitle }</p> | ||
<p>Customer: { customerName }</p> | ||
<p>Checkout date: { checkoutDate } </p> | ||
<p>Due date: { dueDate }</p> | ||
<button className="btn btn-primary" size="sm" onClick={() => {checkinRental(customerId, movieTitle, rentalId)}} type="button">Check in Rental</button> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
RentalCard.propTypes = { | ||
rentalId: PropTypes.number, | ||
movieTitle: PropTypes.string.isRequired, | ||
customerId: PropTypes.number, | ||
customerName: PropTypes.string.isRequired, | ||
checkoutDate: PropTypes.instanceOf(Date).isRequired, | ||
dueDate: PropTypes.instanceOf(Date).isRequired, | ||
checkinRental: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default RentalCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters