Ignore:
Timestamp:
09/21/22 18:47:39 (22 months ago)
Author:
Marko <Marko@…>
Branches:
master
Children:
34950c6
Parents:
5201690
Message:

Component for editing offers added

Location:
phonelux-frontend/src/components/PhoneOfferDetailsComponent
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • phonelux-frontend/src/components/PhoneOfferDetailsComponent/PhoneOfferDetailsComponent.css

    r5201690 rd66b8eb  
    5656.phone-offer-details-last-updated-header{
    5757    width: 25%;
    58     margin-left: 20px;
     58    margin-left: 5%;
    5959    padding: 10px;
    6060    border: 1px solid rgb(199, 193, 193);
    61     background-color: #B6E2C8;
     61    background-color: #dadedc;
    6262    border-radius: 50px;
    6363    text-align: center;
     
    7373.phone-offer-details-edit-header{
    7474    width: 100%;
    75     margin-left: 20px;
     75    margin-left: 5%;
    7676    padding-top: 10px;
    7777    border: 1px solid black;
     
    9696}
    9797
     98.validate-offer-button{
     99    font-size: 17px;
     100    padding: 10px;
     101    background-color:  rgb(170, 211, 240);
     102    border-radius: 30px;
     103    border: 1px solid black;
     104    margin-left: auto;
     105    margin-right: 10%;
     106    width: 15%;
     107    font-weight: bold;
     108    font-size: 18px;
     109    text-align: center;
     110}
    98111
     112.validate-offer-button:hover{
     113    cursor: pointer;
     114    background-color: rgb(149, 187, 215);
     115    box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
     116    transition: box-shadow 0.5s, background-color 0.5s ;
     117}
     118
     119.offer-valid-header{
     120    font-size: 17px;
     121    padding: 10px;
     122    background-color: #96d5b0;
     123    border-radius: 20px;
     124    border: 1px solid black;
     125    margin-left: auto;
     126    margin-right: 10%;
     127    text-align: center;
     128    width: 15%;
     129    font-weight: bold;
     130    font-size: 19px;
     131}
     132
     133
  • phonelux-frontend/src/components/PhoneOfferDetailsComponent/PhoneOfferDetailsComponent.js

    r5201690 rd66b8eb  
    44import HeaderComponent from '../HeaderComponent/HeaderComponent'
    55import UserContext from '../../context/UserContext'
     6import CheckIcon from '@mui/icons-material/Check';
    67import { Link } from 'react-router-dom'
     8import Tippy from '@tippyjs/react'
    79
    810
     
    1921
    2022    componentDidMount(){
    21         axios.get('/phoneoffer/'+this.state.offerId)
     23        this.getPhoneOffer()
     24    }
     25
     26    getPhoneOffer = () => {
     27      axios.get('/phoneoffer/'+this.state.offerId)
    2228        .then(response => {
    2329            this.setState({
     
    2733    }
    2834
     35    validateOffer = () => {
     36      var config = {
     37        method: 'put',
     38        url: '/admin/validateoffer/'+this.state.offerId,
     39        headers: {
     40          'Authorization': 'Bearer '+localStorage.getItem('token')
     41        }
     42      };
     43     
     44      axios(config)
     45      .then(response => {
     46        this.getPhoneOffer();
     47      })
     48      .catch(error => {
     49        console.log(error);
     50      });
     51    }
     52
    2953  render() {
     54    console.log(this.state)
    3055    return (
    3156      <div className='phone-offer-details-main'>
     
    4065              </Link> : <></>
    4166          }
     67       
     68
     69          {(() => {
     70            if(this.state.offer != null && this.state.offer.is_validated)
     71            {
     72              return <Tippy placement='bottom'  content='Понудата е валидна'>
     73                      <CheckIcon className='offer-valid-check-icon' style={{'fontSize': '60px'}}></CheckIcon>
     74                     </Tippy>
     75            }
     76
     77            if(this.state.offer != null && !this.state.offer.is_validated &&
     78              (this.context.role == 'ADMIN' || this.context.role == 'SUPERADMIN'))
     79            {
     80              return <button onClick={this.validateOffer} className='validate-offer-button'>Валидирај понуда</button>
     81            }
     82
     83          })()}
    4284        </div>
     85        <div className='phone-offer-details-last-updated-wrapper'></div>
    4386        <div className='phone-offer-details-table-wrapper'>
    4487        <div className='phone-offer-details-table-section'>
Note: See TracChangeset for help on using the changeset viewer.