Projekt

Obecné

Profil

« Předchozí | Další » 

Revize ebfe6347

Přidáno uživatelem plundrichov před více než 4 roky(ů)

re #58 client part(especially rebuilt api.js, all fetches, little edits in YourRequests/UpcomingRequests and fixed bugs in calendar and overview (add event, save, post, numbers)

Zobrazit rozdíly:

client/src/YourRequests.js
1 1
import React, { useEffect } from 'react';
2 2
import './App.css';
3
import moment from 'moment';
3 4
import * as api_fetch from './api'
4 5

  
5 6
function YourRequests(props) {
......
21 22
        {
22 23
          title: props.userName.name,
23 24
          id: request.id,
24
          start: b,
25
          status: request.status,
26
          type: request.type
25
          start: moment(b).format("D.M.YYYY"),
26
          status: request.status = request.status.toLowerCase(),
27
          type: convertVacationType(request.type)
27 28
        }
28 29
      )
29 30
    }))
......
31 32
      alert(reason)
32 33
    });
33 34
}
35

  
36
function convertVacationType(vacationType) {
37
  // vacationType =  'SICK_DAY' ? 'sickday' : 'holiday'
38

  
39
  // if (vacationType = 'SICK_DAY') {
40
  // return: 'sickday',
41
  // } else {
42
  //   return: 'holiday'
43
  // }
44

  
45
  switch (vacationType) {
46
    case 'SICK_DAY' :
47
      return 'sickday';
48
    case 'HOLIDAY':
49
      return 'holiday';
50
  }
51
}
34 52
  
35 53

  
36 54
  return (
......
40 58
      <div className="offs-items column">
41 59
        <div className="offs-item row">
42 60
          <table>
61
            {props.userRequest.length > 0 ?
62
            
43 63
            <tbody>
44 64
              <tr>
45 65
                <th>Name</th>
......
48 68
                <th>Status</th>    
49 69
              </tr>
50 70
              {props.userRequest.map(user => (
51
              <tr key={user.id}>
71
                <tr key={user.id}>
52 72
                <td>{user.title}</td>
53 73
                <td>{user.type}</td>    
54 74
                <td>{user.end ? user.start + " - " + user.end : user.start}</td>
......
56 76
              </tr>
57 77
              ))}
58 78
            </tbody>
79
            :
80
            <tbody>
81
              <div>No requests</div>
82
            </tbody>}
59 83
          </table>
60 84
        </div>
61 85
      </div>

Také k dispozici: Unified diff