diff --git a/css/global.css b/css/global.css index 2521b66..bc5eda0 100644 --- a/css/global.css +++ b/css/global.css @@ -72,3 +72,17 @@ footer p { justify-content: center; margin-bottom: 0px; } + +/* Modal */ +.modal-content { + color: white; +} + +#exampleModal { + color: white; + background-color: rgba(255, 255, 255, 0.1) +} + +#modal-footer { + background-color: #272727; +} \ No newline at end of file diff --git a/img/procurement.png b/img/procurement.png new file mode 100644 index 0000000..f7cac9b Binary files /dev/null and b/img/procurement.png differ diff --git a/img/shuttle.png b/img/shuttle.png new file mode 100644 index 0000000..92dab5d Binary files /dev/null and b/img/shuttle.png differ diff --git a/img/transportation.png b/img/transportation.png new file mode 100644 index 0000000..7c197ce Binary files /dev/null and b/img/transportation.png differ diff --git a/scripts/api.js b/scripts/api.js index 82263a1..b328163 100644 --- a/scripts/api.js +++ b/scripts/api.js @@ -121,5 +121,16 @@ export default { return REQUEST(url, "GET", headers); }, + + accept: async (contratId, token) => { + const url = `${spacetradersApiUrl}my/contracts/${contratId}/accept`; + const headers = { + 'Content-Type': 'application/json', + Accept: "application/json", + Authorization: `Bearer ${token}`, + }; + + return REQUEST(url, "POST", headers); + } }, }; diff --git a/scripts/auth.js b/scripts/auth.js index 5fd96b6..f633cf8 100644 --- a/scripts/auth.js +++ b/scripts/auth.js @@ -63,7 +63,8 @@ export default { } else { showError("Symbol ou faction invalide"); } - } catch { + } catch (error) { + console.log(error) showError("Erreur lors de l'inscription"); } }, diff --git a/scripts/main.js b/scripts/main.js index 2fa94d0..20f7307 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -67,21 +67,56 @@ async function contract() { $('main').empty() contracts.forEach(contrat => { - console.log(contrat); - const card = - ` + let img + let status + let card + console.log(contrat) + if (contrat.type = "PROCUREMENT") { + img = "/img/procurement.png" + } + else if (contrat.type = "TRANSPORT") { + img = "/img/transportation.png" + } + else { + img = "/img/shuttle.png" + } + if (contrat.accepted) { + status = "accepté" + card = + `
${contrat.accepted}
- - -${contrat.deadlineToAccept}
+Status : ${status}
+ +${contrat.deadlineToAccept}
+Status : ${status}
+ + +