1 | import React, { Component } from 'react'
|
---|
2 | import Box from '@mui/material/Box';
|
---|
3 | import Modal from '@mui/material/Modal';
|
---|
4 | import "./CheaperOffersComponent.css"
|
---|
5 | import PhoneOfferComponent from '../PhoneOfferComponent/PhoneOfferComponent';
|
---|
6 | import { Link } from 'react-router-dom';
|
---|
7 |
|
---|
8 |
|
---|
9 | export class CheaperOffersComponent extends Component {
|
---|
10 | constructor(props) {
|
---|
11 | super(props)
|
---|
12 |
|
---|
13 | this.state = {
|
---|
14 |
|
---|
15 | }
|
---|
16 | }
|
---|
17 |
|
---|
18 | render() {
|
---|
19 |
|
---|
20 | return (
|
---|
21 | <div className='cheaperoffers-modal-main'>
|
---|
22 | <Modal
|
---|
23 | open={this.props.openModal}
|
---|
24 | onClose={this.props.handleClose}
|
---|
25 | aria-labelledby="cheaperoffers-modal-title"
|
---|
26 | aria-describedby="cheaperoffers-modal-description"
|
---|
27 | >
|
---|
28 | {
|
---|
29 | this.props.cheaperOffers.length > 0 ?
|
---|
30 | <Box className='cheaperoffers-modal-box'>
|
---|
31 | <table cellPadding={20} className='cheaperoffers-table'>
|
---|
32 | <thead className='cheaperoffers-table-head'>
|
---|
33 | <tr>
|
---|
34 | <th>Продавница</th>
|
---|
35 | <th>Име на понуда</th>
|
---|
36 | <th>Цена</th>
|
---|
37 | <th>Поевтина за</th>
|
---|
38 | <th></th>
|
---|
39 | </tr>
|
---|
40 | </thead>
|
---|
41 | <tbody>
|
---|
42 | {
|
---|
43 | this.props.cheaperOffers.map((offer,idx) =>
|
---|
44 | <tr key={idx} className='cheaperoffers-table-row'>
|
---|
45 | <td>{offer.offer_shop}</td>
|
---|
46 | <td><a href={offer.offer_url}>{offer.offer_name}</a></td>
|
---|
47 | <td>{offer.price} ден.</td>
|
---|
48 | <td><b>{this.props.openedOfferPrice-offer.price} ден.</b></td>
|
---|
49 | <td>
|
---|
50 | <Link style={{ textDecoration: 'none' }} to={"/phoneoffer/"+offer.id}>
|
---|
51 | <button className='phone-offer-specifications-button'>Спецификации</button>
|
---|
52 | </Link>
|
---|
53 | </td>
|
---|
54 | </tr>
|
---|
55 | )
|
---|
56 | }
|
---|
57 | </tbody>
|
---|
58 | </table>
|
---|
59 | </Box> : <h1 className='no-cheaper-offers-message'>Нема поевтини понуди</h1>
|
---|
60 | }
|
---|
61 | </Modal>
|
---|
62 | </div>
|
---|
63 | )
|
---|
64 | }
|
---|
65 | }
|
---|
66 |
|
---|
67 | export default CheaperOffersComponent
|
---|
68 |
|
---|
69 |
|
---|