diff --git a/img/contrat.jpg b/img/contrat.jpg new file mode 100644 index 0000000..2f9b7dc Binary files /dev/null and b/img/contrat.jpg differ diff --git a/index.html b/index.html index b6de163..4978638 100644 --- a/index.html +++ b/index.html @@ -2,53 +2,58 @@ - - - - - - - - - - - - SkamCraft - - - - + +
+ + + +
-
+ + - - - + \ No newline at end of file diff --git a/scripts/main.js b/scripts/main.js index f53bd51..2fa94d0 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -35,9 +35,9 @@ $(document).ready(async function () { $("#btn-contract").on("click", () => { contract(); }); - $("#btn-faction").on("click", () => {}); - $("#btn-ship").on("click", () => {}); - $("#btn-system").on("click", () => {}); + $("#btn-faction").on("click", () => { }); + $("#btn-ship").on("click", () => { }); + $("#btn-system").on("click", () => { }); $("#btn-logout").on("click", () => { logout(); }); @@ -60,17 +60,50 @@ async function agent() { } async function contract() { + const token = localStorage.getItem("token"); const contracts = await SpaceTraders.Contract.list(token); - $("main").empty(); + $('main').empty() + + contracts.forEach(contrat => { + console.log(contrat); + const card = + ` +
+ +
+
${contrat.factionSymbol}
+

${contrat.accepted}

+ + +
+
+ ` - contracts.forEach((contract) => { - let card = `
-
-

${contract.id}

+ $('main').append(card) + $('#btn-infos').on('click', async function () { + const token = localStorage.getItem("token"); + const contrat = await SpaceTraders.Contract.get($(this).attr('contratID'), token); + const modal = ` + ;`; - $("main").append(card); - }); +
` + $('main').append(modal) + }) + }) } diff --git a/templates/contract.html b/templates/contract.html deleted file mode 100644 index ee9d8d9..0000000 --- a/templates/contract.html +++ /dev/null @@ -1 +0,0 @@ -