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 @@
css_class: "",
description: "Payment State",
hidden: 0,
"default": {value: value},
"default": value,
key: "translated_simulation_state_title",
url: "gadget_slapos_invoice_state.html",
title: "Payment State",
......@@ -70,7 +70,7 @@
css_class: "",
description: "Download Invoice",
hidden: 0,
"default": {jio_key: value},
"default": {jio_key: result.data.rows[i].id},
key: "download",
url: "gadget_slapos_invoice_printout.html",
title: "Download",
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1001.59414.5078.17476</string> </value>
<value> <string>1004.6715.25695.5000</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1659068942.39</float>
<float>1667590788.38</float>
<string>UTC</string>
</tuple>
</state>
......
/*globals console, window, rJS, RSVP, domsugar */
/*globals console, window, rJS, domsugar */
/*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, rJS, domsugar) {
......@@ -21,37 +21,31 @@
[
domsugar("a", {
class: "ui-btn ui-first-child ui-btn-icon-center",
// XXX Translation
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"
})
]);
} else {
link = domsugar("li", {"text": gadget.state.payment_transaction});
link = domsugar("li", {"text": gadget.state.payment_state});
}
domsugar(gadget.element, {}, [
domsugar("ul", {"class": "grid-items"}, [link])
]);
return translation_dict;
})
});
})
.declareMethod("render", function (options) {
var gadget = this;
return gadget.getSetting("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({
payment_transaction: state.payment_transaction,
payment_state: state.state,
hateoas_url: hateoas_url
});
});
return gadget.changeState({
payment_transaction: options.value.payment_transaction,
payment_state: options.value.state,
hateoas_url: hateoas_url
});
});
});
}(window, rJS, domsugar));
\ No newline at end of file
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1000.58215.43208.28603</string> </value>
<value> <string>1004.6708.42252.52667</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1655125229.22</float>
<float>1667590949.4</float>
<string>UTC</string>
</tuple>
</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