Commit 55ff4dc9 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: render payment state with fetch

   There isnt a need to fetch on every line, since the information comes from options
parent 1a6e8873
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
css_class: "", css_class: "",
description: "Payment State", description: "Payment State",
hidden: 0, hidden: 0,
"default": {value: value}, "default": value,
key: "translated_simulation_state_title", key: "translated_simulation_state_title",
url: "gadget_slapos_invoice_state.html", url: "gadget_slapos_invoice_state.html",
title: "Payment State", title: "Payment State",
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
css_class: "", css_class: "",
description: "Download Invoice", description: "Download Invoice",
hidden: 0, hidden: 0,
"default": {jio_key: value}, "default": {jio_key: result.data.rows[i].id},
key: "download", key: "download",
url: "gadget_slapos_invoice_printout.html", url: "gadget_slapos_invoice_printout.html",
title: "Download", title: "Download",
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1001.59414.5078.17476</string> </value> <value> <string>1004.6715.25695.5000</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1659068942.39</float> <float>1667590788.38</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*globals console, window, rJS, RSVP, domsugar */ /*globals console, window, rJS, domsugar */
/*jslint indent: 2, nomen: true, maxlen: 80*/ /*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, rJS, domsugar) { (function (window, rJS, domsugar) {
...@@ -21,37 +21,31 @@ ...@@ -21,37 +21,31 @@
[ [
domsugar("a", { domsugar("a", {
class: "ui-btn ui-first-child ui-btn-icon-center", class: "ui-btn ui-first-child ui-btn-icon-center",
// XXX Translation
text: translation_dict["Pay Now"], text: translation_dict["Pay Now"],
href: gadget.state.hateoas_url + gadget.state.payment_transaction + href: gadget.state.hateoas_url +
gadget.state.payment_transaction +
"/PaymentTransaction_redirectToManualSlapOSPayment" "/PaymentTransaction_redirectToManualSlapOSPayment"
}) })
]); ]);
} else { } else {
link = domsugar("li", {"text": gadget.state.payment_transaction}); link = domsugar("li", {"text": gadget.state.payment_state});
} }
domsugar(gadget.element, {}, [ domsugar(gadget.element, {}, [
domsugar("ul", {"class": "grid-items"}, [link]) domsugar("ul", {"class": "grid-items"}, [link])
]); ]);
return translation_dict; return translation_dict;
}) });
}) })
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
var gadget = this; var gadget = this;
return gadget.getSetting("hateoas_url") return gadget.getSetting("hateoas_url")
.push(function (hateoas_url) { .push(function (hateoas_url) {
// XXX RAFAEL this should comes from the options and not from a query like this.
return gadget.jio_getAttachment(options.value.jio_key,
hateoas_url + options.value.jio_key +
"/AccountingTransaction_getPaymentStateAsHateoas")
.push(function (state) {
return gadget.changeState({ return gadget.changeState({
payment_transaction: state.payment_transaction, payment_transaction: options.value.payment_transaction,
payment_state: state.state, payment_state: options.value.state,
hateoas_url: hateoas_url hateoas_url: hateoas_url
}); });
}); });
}); });
});
}(window, rJS, domsugar)); }(window, rJS, domsugar));
\ No newline at end of file
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1000.58215.43208.28603</string> </value> <value> <string>1004.6708.42252.52667</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1655125229.22</float> <float>1667590949.4</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment