Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | 6x 24x 6x 13x 13x 6x 33x 24x 17x 17x 4x 13x 13x | import VerticalLayout from './VerticalLayout.js'
import ErrorPage from "./ErrorPage.js"
import LoadingPage from "./LoadingPage.js"
import Actions from './Actions.js'
const row = (bill) => {
return (`
<tr>
<td>${bill.type}</td>
<td>${bill.name}</td>
<td>${bill.date}</td>
<td>${bill.amount} €</td>
<td>${bill.status}</td>
<td>
${Actions(bill.fileUrl)}
</td>
</tr>
`)
}
const rows = (data) => {
let sortedData = [];
if (data && data.length){
sortedData = data.sort((a,b) => {
return new Date(b.date) - new Date(a.date);
})
}
return (sortedData && sortedData.length) ? sortedData.map(bill => row(bill)).join("") : ""
}
export default ({ data: bills, loading, error }) => {
const modal = () => (`
<div class="modal fade" id="modaleFile" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Justificatif</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
</div>
</div>
</div>
</div>
`)
if (loading) {
return LoadingPage()
} else Iif (error) {
return ErrorPage(error)
}
return (`
<div class='layout'>
${VerticalLayout(120)}
<div class='content'>
<div class='content-header'>
<div class='content-title'> Mes notes de frais </div>
<button type="button" data-testid='btn-new-bill' class="btn btn-primary">Nouvelle note de frais</button>
</div>
<div id="data-table">
<table id="example" class="table table-striped" style="width:100%">
<thead>
<tr>
<th>Type</th>
<th>Nom</th>
<th>Date</th>
<th>Montant</th>
<th>Statut</th>
<th>Actions</th>
</tr>
</thead>
<tbody data-testid="tbody">
${rows(bills)}
</tbody>
</table>
</div>
</div>
${modal()}
</div>`
)
} |