Commit 3ecbfd4d authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Improvements for Invoice List and view

parent dccdfcfd
......@@ -24,7 +24,7 @@
allow_empty_time: 0,
ampm_time_style: 0,
css_class: "date_field",
date_only: 0,
date_only: 1,
description: "The Date",
editable: 0,
hidden: 0,
......@@ -38,6 +38,13 @@
};
}
if (result.data.rows[i].value.hasOwnProperty("total_price")) {
value = window.parseFloat(result.data.rows[i].value.total_price);
// The field seemms not set precision to display
value = value.toFixed(2); // round on this case for 2 digits as
// float field is bugged.
result.data.rows[i].value.total_price = value;
}
if (1 || (result.data.rows[i].hasOwnProperty("id"))) {
value = result.data.rows[i].id;
result.data.rows[i].value.translated_simulation_state_title = {
......@@ -94,9 +101,9 @@
})
.push(function (form_list) {
var column_list = [
['title', 'Title'],
['start_date', 'Date'],
['total_price', 'Price'],
['resource_reference', 'Currency'],
['translated_simulation_state_title', 'Payment'],
['download', 'Download']
];
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>964.60286.59381.65058</string> </value>
<value> <string>965.22041.26321.21384</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1516369858.23</float>
<float>1518007364.17</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -57,20 +57,26 @@
return gadget.getDeclaredGadget('form_view');
})
.push(function (form_gadget) {
var editable = gadget.state.editable;
var start_date = new Date(gadget.state.doc.start_date),
total_price = window.parseFloat(gadget.state.doc.total_price).toFixed(2);
return form_gadget.render({
erp5_document: {
"_embedded": {"_view": {
"my_title": {
"description": "",
"title": "Title",
"default": gadget.state.doc.title,
"css_class": "",
"required": 1,
"my_start_date": {
"allow_empty_time": 0,
"ampm_time_style": 0,
"css_class": "date_field",
"date_only": 1,
"description": "The Date",
"editable": 0,
"key": "title",
"hidden": 0,
"type": "StringField"
"hidden_day_is_last_day": 0,
"default": start_date.toUTCString(),
"key": "date",
"required": 0,
"timezone_style": 0,
"title": "Date",
"type": "DateTimeField"
},
"my_reference": {
"description": "",
......@@ -83,6 +89,28 @@
"hidden": 0,
"type": "StringField"
},
"my_total_price": {
"description": "",
"title": "Total",
"default": total_price,
"css_class": "",
"required": 1,
"editable": 0,
"key": "total_price",
"hidden": 0,
"type": "StringField"
},
"my_resource_title": {
"description": "",
"title": "Currency",
"default": gadget.state.doc.resource_title,
"css_class": "",
"required": 1,
"editable": 0,
"key": "resource_title",
"hidden": 0,
"type": "StringField"
},
"my_payment_state": {
"description": "",
"title": "Payment State",
......@@ -92,7 +120,7 @@
"editable": 0,
"url": "gadget_slapos_invoice_state.html",
"sandbox": "",
"key": "monitoring_status",
"key": "payment_state",
"hidden": 0,
"type": "GadgetField"
},
......@@ -120,7 +148,8 @@
form_definition: {
group_list: [[
"left",
[["my_title"], ["my_reference"], ['my_payment_state'], ["my_download"]]
[["my_start_date"], ["my_reference"], ["my_total_price"],
["my_resource_title"], ['my_payment_state'], ["my_download"]]
]]
}
});
......@@ -131,10 +160,8 @@
]);
})
.push(function (url_list) {
var header_dict = {
page_title: gadget.state.doc.title,
save_action: true
};
var start_date = new Date(gadget.state.doc.start_date),
header_dict = {page_title: "Invoice : " + start_date.toUTCString()};
if (!gadget.state.editable) {
header_dict.edit_content = url_list[0];
}
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>964.64860.64104.58709</string> </value>
<value> <string>965.22103.26552.47598</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1516644362.67</float>
<float>1518011453.92</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -95,6 +95,9 @@
<list>
<string>my_title</string>
<string>my_reference</string>
<string>my_start_date</string>
<string>my_total_price</string>
<string>my_resource_title</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_resource_title</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Reference</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_start_date</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Reference</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.getStartDate().strftime("%Y/%m/%d %H:%M:%S UTC")</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_total_price</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_title</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewWebFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -17,6 +17,7 @@ Person | request_hateoas_hosting_subscription
Person | slaposjs_view
Project | slaposjs_view
Regularisation Request | slaposjs_view
Sale Invoice Transaction | slaposjs_view
Slave Instance | get_hateoas_information
Slave Instance | get_hateoas_news
Slave Instance | get_hateoas_related_hosting_subscription
......
......@@ -132,5 +132,9 @@ web_page_module/rjs_gadget_slapos_invoice_printout_js
web_page_module/rjs_gadget_slapos_invoice_printout_html
web_page_module/rjs_gadget_slapos_invoice_state_js
web_page_module/rjs_gadget_slapos_invoice_state_html
web_page_module/rjs_gadget_erp5_page_slap_sale_invoice_transaction_view_js
web_page_module/rjs_gadget_erp5_page_slap_sale_invoice_transaction_view_html
web_page_module/rjs_gadget_slapos_payment_result_js
web_page_module/rjs_gadget_erp5_page_slap_payment_result_html
web_site_module/hostingjs
web_site_module/hostingjs/**
\ No newline at end of file
......@@ -51,6 +51,7 @@ web_page_module/rjs_gadget_erp5_page_slap_organisation_view_js
web_page_module/rjs_gadget_erp5_page_slap_parameter_form_css
web_page_module/rjs_gadget_erp5_page_slap_parameter_form_html
web_page_module/rjs_gadget_erp5_page_slap_parameter_form_js
web_page_module/rjs_gadget_erp5_page_slap_payment_result_html
web_page_module/rjs_gadget_erp5_page_slap_person_get_token_html
web_page_module/rjs_gadget_erp5_page_slap_person_get_token_js
web_page_module/rjs_gadget_erp5_page_slap_person_request_certificate_html
......@@ -67,6 +68,8 @@ web_page_module/rjs_gadget_erp5_page_slap_regularisation_request_view_html
web_page_module/rjs_gadget_erp5_page_slap_regularisation_request_view_js
web_page_module/rjs_gadget_erp5_page_slap_rss_ticket_html
web_page_module/rjs_gadget_erp5_page_slap_rss_ticket_js
web_page_module/rjs_gadget_erp5_page_slap_sale_invoice_transaction_view_html
web_page_module/rjs_gadget_erp5_page_slap_sale_invoice_transaction_view_js
web_page_module/rjs_gadget_erp5_page_slap_select_software_product_html
web_page_module/rjs_gadget_erp5_page_slap_select_software_product_js
web_page_module/rjs_gadget_erp5_page_slap_select_software_release_html
......@@ -124,6 +127,7 @@ web_page_module/rjs_gadget_slapos_network_status_html
web_page_module/rjs_gadget_slapos_network_status_js
web_page_module/rjs_gadget_slapos_panel_html
web_page_module/rjs_gadget_slapos_panel_js
web_page_module/rjs_gadget_slapos_payment_result_js
web_page_module/rjs_gadget_slapos_project_status_html
web_page_module/rjs_gadget_slapos_project_status_js
web_page_module/rjs_gadget_slapos_site_status_html
......
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