Code lisible

ruben
Ruben Tome ago%!(EXTRA string=2 years)
parent bbebca1b42
commit 4834318b9c
  1. 35
      js/controllers/contracts.js

@ -34,17 +34,9 @@ export default (temp_engine) => {
temp_engine.add_event(".btn-infos", "click", (e) => { temp_engine.add_event(".btn-infos", "click", (e) => {
contracts.forEach((contract) => { contracts.forEach((contract) => {
// console.log(e)
const id_contract = $(e.target).attr("data-id"); const id_contract = $(e.target).attr("data-id");
// const contract = contracts.find((element) => {
// console.log(element);
// return element.id == id_contract;
// });
// const date = new Date(contract.expiration);
// console.log(date)
// let expiration = (date.getHours() + "h" + date.getMinutes() + ", " + date.getUTCMonth() + "." + date.getMonth() + "." +date.getFullYear());
$(".contract-id").text("ID : " + contract.id); $(".contract-id").text("ID : " + contract.id);
$(".contract-faction").text("Faction : " + contract.faction); $(".contract-faction").text("Faction : " + contract.faction);
$(".contract-type").text("Type : " + contract.type); $(".contract-type").text("Type : " + contract.type);
@ -53,11 +45,11 @@ export default (temp_engine) => {
$(".contract-payment-fulfill").text("Payment fulfill : " + contract.paymentFulfill + " $"); $(".contract-payment-fulfill").text("Payment fulfill : " + contract.paymentFulfill + " $");
$(".contract-tradeSymbol").text("Trade Symbol : " + contract.tradeSymbol); $(".contract-tradeSymbol").text("Trade Symbol : " + contract.tradeSymbol);
$(".contract-destinationSymbol").text("Destination : " + contract.destination); $(".contract-destinationSymbol").text("Destination : " + contract.destination);
modal.show(); modal.show();
}); });
}); });
contracts.forEach(contract => { contracts.forEach(contract => {
@ -75,8 +67,6 @@ export default (temp_engine) => {
img = "/assets/contracts/shuttle.png" img = "/assets/contracts/shuttle.png"
} }
if (contract.accepted) { if (contract.accepted) {
status = "accepted" status = "accepted"
card = card =
@ -92,6 +82,7 @@ export default (temp_engine) => {
</div> </div>
` `
} }
else { else {
status = "on hold" status = "on hold"
card = card =
@ -109,25 +100,13 @@ export default (temp_engine) => {
</div> </div>
` `
} }
$('.contracts').append(card);
$('.contracts').append(card);
}); });
}) })
temp_engine.add_event(".btn-close", "click", () => { temp_engine.add_event(".btn-close", "click", () => {
modal.close(); modal.close();
}); });

Loading…
Cancel
Save