This repository was archived by the owner on Sep 3, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +86
-0
lines changed
application/src/components/view-orders Expand file tree Collapse file tree 2 files changed +86
-0
lines changed Original file line number Diff line number Diff line change
1
+ .view-order-container {
2
+ font-family : "Optima" , serif;
3
+ min-height : 100px ;
4
+ border-bottom : solid 1px # 999 ;
5
+ }
6
+
7
+ .view-order-container p {
8
+ margin : 0 ;
9
+ }
10
+
11
+ .view-order-container button {
12
+ margin-left : 20px ;
13
+ }
14
+
15
+ .view-order-left-col {
16
+ display : flex;
17
+ align-items : center;
18
+ }
19
+
20
+ .view-order-middle-col {
21
+ display : flex;
22
+ flex-direction : column;
23
+ align-items : center;
24
+ justify-content : center;
25
+ }
26
+
27
+ .view-order-right-col {
28
+ display : flex;
29
+ align-items : center;
30
+ justify-content : flex-end;
31
+ }
32
+
33
+ @media only screen and (max-width : 768px ) {
34
+ .view-order-left-col {
35
+ justify-content : center;
36
+ }
37
+
38
+ .view-order-middle-col {
39
+ margin-bottom : 20px ;
40
+ }
41
+
42
+ .view-order-right-col {
43
+ padding-bottom : 20px ;
44
+ justify-content : space-around;
45
+ }
46
+
47
+ .view-order-container button {
48
+ margin : 0 ;
49
+ }
50
+ }
Original file line number Diff line number Diff line change @@ -3,9 +3,45 @@ import { Template } from '../../components';
3
3
import './viewOrders.css' ;
4
4
5
5
class ViewOrders extends Component {
6
+ state = {
7
+ orders : [ ]
8
+ }
9
+
10
+ componentDidMount ( ) {
11
+ fetch ( 'http://localhost:4000/api/current-orders' )
12
+ . then ( response => response . json ( ) )
13
+ . then ( response => {
14
+ if ( response . success ) {
15
+ this . setState ( { orders : response . orders } ) ;
16
+ } else {
17
+ console . log ( 'Error getting orders' ) ;
18
+ }
19
+ } ) ;
20
+ }
21
+
6
22
render ( ) {
7
23
return (
8
24
< Template >
25
+ < div className = "container-fluid" >
26
+ { this . state . orders . map ( order => {
27
+ const createdDate = new Date ( order . createdAt ) ;
28
+ return (
29
+ < div className = "row view-order-container" key = { order . _id } >
30
+ < div className = "col-md-4 view-order-left-col p-3" >
31
+ < h2 > { order . order_item } </ h2 >
32
+ </ div >
33
+ < div className = "col-md-4 d-flex view-order-middle-col" >
34
+ < p > Order placed at { `${ createdDate . getHours ( ) } :${ createdDate . getMinutes ( ) } :${ createdDate . getSeconds ( ) } ` } </ p >
35
+ < p > Quantity: { order . quantity } </ p >
36
+ </ div >
37
+ < div className = "col-md-4 view-order-right-col" >
38
+ < button className = "btn btn-success" > Edit</ button >
39
+ < button className = "btn btn-danger" > Delete</ button >
40
+ </ div >
41
+ </ div >
42
+ ) ;
43
+ } ) }
44
+ </ div >
9
45
</ Template >
10
46
) ;
11
47
}
You can’t perform that action at this time.
0 commit comments