[e5b84dc] | 1 | import React, { Component } from 'react'
|
---|
| 2 | import axios from 'axios'
|
---|
| 3 | import './PhoneOfferDetailsComponent.css'
|
---|
| 4 | import HeaderComponent from '../HeaderComponent/HeaderComponent'
|
---|
| 5 |
|
---|
| 6 |
|
---|
| 7 | export class PhoneOfferDetailsComponent extends Component {
|
---|
| 8 |
|
---|
| 9 | constructor(props) {
|
---|
| 10 | super(props)
|
---|
| 11 |
|
---|
| 12 | this.state = {
|
---|
| 13 | offerId: window.location.href.split('/')[4],
|
---|
| 14 | offer: null
|
---|
| 15 | }
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | componentDidMount(){
|
---|
| 19 | axios.get('/phoneoffer/'+this.state.offerId)
|
---|
| 20 | .then(response => {
|
---|
| 21 | this.setState({
|
---|
| 22 | offer: response.data
|
---|
| 23 | })
|
---|
| 24 | }).catch(error => console.log(error))
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | render() {
|
---|
| 28 | console.log(this.state)
|
---|
| 29 | return (
|
---|
| 30 | <div className='phone-offer-details-main'>
|
---|
| 31 | <HeaderComponent/>
|
---|
| 32 | <div className='phone-offer-details-last-updated-wrapper'>
|
---|
| 33 | <h3 className='phone-offer-details-last-updated-header'>Последно ажурирана: {this.state.offer == null ||
|
---|
| 34 | this.state.offer.last_updated == null ? '#' : this.state.offer.last_updated.split('T')[0]}</h3>
|
---|
| 35 | </div>
|
---|
| 36 | <div className='phone-offer-details-table-wrapper'>
|
---|
| 37 | <div className='phone-offer-details-table-section'>
|
---|
| 38 | <table className='phone-offer-details-table'>
|
---|
| 39 | <thead>
|
---|
| 40 | <tr><th colSpan={2}>Детали за понудата</th></tr>
|
---|
| 41 | </thead>
|
---|
| 42 | <tbody>
|
---|
| 43 | <tr className='phone-offer-details-table-row'>
|
---|
| 44 | <td>Понуда</td><td><a href={this.state.offer == null || this.state.offer.offer_url == null ?
|
---|
| 45 | '#' : this.state.offer.offer_url}>{this.state.offer == null || this.state.offer.offer_name == null ?
|
---|
| 46 | '/' : this.state.offer.offer_name}</a></td>
|
---|
| 47 | </tr>
|
---|
| 48 |
|
---|
| 49 | <tr className='phone-offer-details-table-row'>
|
---|
| 50 | <td>Продавница</td><td>{this.state.offer == null ||
|
---|
| 51 | this.state.offer.offer_shop == null ? '/' : this.state.offer.offer_shop}</td>
|
---|
| 52 | </tr>
|
---|
| 53 |
|
---|
| 54 | <tr className='phone-offer-details-table-row'>
|
---|
| 55 | <td>Цена</td><td>{this.state.offer == null ||
|
---|
| 56 | this.state.offer.price == null ? '/' : this.state.offer.price+' ден.'}</td>
|
---|
| 57 | </tr>
|
---|
| 58 | <tr className='phone-offer-details-table-row'>
|
---|
| 59 | <td>Предна камера</td><td>{this.state.offer == null ||
|
---|
| 60 | this.state.offer.front_camera == null ? '/' : this.state.offer.front_camera}</td>
|
---|
| 61 | </tr>
|
---|
| 62 |
|
---|
| 63 | <tr className='phone-offer-details-table-row'>
|
---|
| 64 | <td>Задна камера</td><td>{this.state.offer == null ||
|
---|
| 65 | this.state.offer.back_camera == null ? '/' : this.state.offer.back_camera}</td>
|
---|
| 66 | </tr>
|
---|
| 67 |
|
---|
| 68 | <tr className='phone-offer-details-table-row'>
|
---|
| 69 | <td>РОМ меморија</td><td>{this.state.offer == null ||
|
---|
| 70 | this.state.offer.rom_memory == null ? '/' : this.state.offer.rom_memory}</td>
|
---|
| 71 | </tr>
|
---|
| 72 |
|
---|
| 73 | <tr className='phone-offer-details-table-row'>
|
---|
| 74 | <td>РАМ меморија</td><td>{this.state.offer == null ||
|
---|
| 75 | this.state.offer.ram_memory == null ? '/' : this.state.offer.ram_memory}</td>
|
---|
| 76 | </tr>
|
---|
| 77 |
|
---|
| 78 | <tr className='phone-offer-details-table-row'>
|
---|
| 79 | <td>Оперативен систем</td><td>{this.state.offer == null ||
|
---|
| 80 | this.state.offer.operating_system == null ? '/' : this.state.offer.operating_system}</td>
|
---|
| 81 | </tr>
|
---|
| 82 |
|
---|
| 83 | <tr className='phone-offer-details-table-row'>
|
---|
| 84 | <td>Чипсет</td><td>{this.state.offer == null ||
|
---|
| 85 | this.state.offer.chipset == null ? '/' : this.state.offer.chipset}</td>
|
---|
| 86 | </tr>
|
---|
| 87 |
|
---|
| 88 | <tr className='phone-offer-details-table-row'>
|
---|
| 89 | <td>Процесор</td><td>{this.state.offer == null ||
|
---|
| 90 | this.state.offer.cpu == null ? '/' : this.state.offer.cpu}</td>
|
---|
| 91 | </tr>
|
---|
| 92 |
|
---|
| 93 | <tr className='phone-offer-details-table-row'>
|
---|
| 94 | <td>Батерија</td><td>{this.state.offer == null ||
|
---|
| 95 | this.state.offer.battery == null ? '/' : this.state.offer.battery}</td>
|
---|
| 96 | </tr>
|
---|
| 97 |
|
---|
| 98 | <tr className='phone-offer-details-table-row'>
|
---|
| 99 | <td>Боја</td><td>{this.state.offer == null ||
|
---|
| 100 | this.state.offer.color == null ? '/' : this.state.offer.color}</td>
|
---|
| 101 | </tr>
|
---|
| 102 |
|
---|
| 103 | <tr className='phone-offer-details-table-row'>
|
---|
| 104 | <td>Опис</td><td>{this.state.offer == null ||
|
---|
| 105 | this.state.offer.offer_description == null ? '/' : this.state.offer.offer_description}</td>
|
---|
| 106 | </tr>
|
---|
| 107 |
|
---|
| 108 | </tbody>
|
---|
| 109 | </table>
|
---|
| 110 | </div>
|
---|
| 111 | </div>
|
---|
| 112 |
|
---|
| 113 | </div>
|
---|
| 114 | )
|
---|
| 115 | }
|
---|
| 116 | }
|
---|
| 117 |
|
---|
| 118 | export default PhoneOfferDetailsComponent
|
---|