Skip to content
Snippets Groups Projects
Commit d754db44 authored by daniquilez's avatar daniquilez
Browse files

linter corrections

parent 343a4580
No related branches found
No related tags found
2 merge requests!277[REL] Release Sprint 27/11/23,!244Feature/company data public form
Pipeline #66765 passed
...@@ -30,6 +30,7 @@ _COMMUNITY_DATA__GENERAL_FIELDS = { ...@@ -30,6 +30,7 @@ _COMMUNITY_DATA__GENERAL_FIELDS = {
"ce_constitution_state": _("Constitution state"), "ce_constitution_state": _("Constitution state"),
"ce_constitution_state_other": _("Which one?"), "ce_constitution_state_other": _("Which one?"),
"ce_legal_form": _("Community legal form"), "ce_legal_form": _("Community legal form"),
"ce_constitution_date": _("Constitution date"),
} }
_COMMUNITY_DATA__FIELDS.update(_COMMUNITY_DATA__GENERAL_FIELDS) _COMMUNITY_DATA__FIELDS.update(_COMMUNITY_DATA__GENERAL_FIELDS)
_COMMUNITY_DATA__IMAGE_FIELDS = { _COMMUNITY_DATA__IMAGE_FIELDS = {
...@@ -328,6 +329,8 @@ class WebsiteCommunityData(http.Controller): ...@@ -328,6 +329,8 @@ class WebsiteCommunityData(http.Controller):
_COMMUNITY_DATA__IMAGE_FIELDS[image_field_key] _COMMUNITY_DATA__IMAGE_FIELDS[image_field_key]
) )
) )
# TODO: Date validation!!
if error_msgs: if error_msgs:
values["error"] = error values["error"] = error
values["error_msgs"] = error_msgs values["error_msgs"] = error_msgs
......
odoo.define("community_data.oe_community_data", function (require) {
"use strict";
$(document).ready(function () {
var ajax = require("web.ajax");
$(".oe_community_data").each(function () {
var oe_community_data = this;
var locale = $(".o_website_form_date").data("locale");
$.datepicker.regional = {
ca_ES: {
monthNamesShort: [
"Gen",
"Feb",
"Mar",
"Abr",
"Mai",
"Jun",
"Jul",
"Ago",
"Set",
"Oct",
"Nov",
"Dec",
],
},
es_ES: {
monthNamesShort: [
"Ene",
"Feb",
"Mar",
"Abr",
"May",
"Jun",
"Jul",
"Ago",
"Sept",
"Oct",
"Nov",
"Dic",
],
},
};
$.datepicker.setDefaults($.datepicker.regional[locale]);
$(".o_website_form_date_past").datepicker({
dateFormat: "dd/mm/yy",
changeMonth: true,
changeYear: true,
maxDate: "today",
yearRange: "2010:+0",
});
//$(oe_cooperator).on("change", "#ordered_parts", function (event) {
// var $share_price = $("#share_price").text();
// var $link = $(event.currentTarget);
// var quantity = $link[0].value;
// var total_part = quantity * $share_price;
// $("#total_parts").val(total_part);
// return false;
//});
//$(oe_cooperator).on("focusout", "input.js_quantity", function () {
// $("a.js_add_cart_json").trigger("click");
//});
//$("#share_product_id").trigger("change");
});
});
});
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<odoo> <odoo>
<template
id="assets_frontend"
inherit_id="web.assets_frontend"
name="community_data_website_script"
>
<xpath expr="." position="inside">
<script
type="text/javascript"
src="/energy_communities/static/src/js/community-data-website.js"
/>
</xpath>
</template>
<template <template
id="community_data_form_fields_template" id="community_data_form_fields_template"
name="community_data_form_fields_template" name="community_data_form_fields_template"
...@@ -192,6 +206,13 @@ ...@@ -192,6 +206,13 @@
<t t-set="options" t-value="community_legal_form_options" /> <t t-set="options" t-value="community_legal_form_options" />
</t> </t>
</div> </div>
<div class="col-md-12">
<t t-call="energy_communities.form_field_date_past">
<t t-set="value" t-value="ce_constitution_date" />
<t t-set="key" t-value="ce_constitution_date_key" />
<t t-set="label" t-value="ce_constitution_date_label" />
</t>
</div>
</div> </div>
</template> </template>
...@@ -256,7 +277,7 @@ ...@@ -256,7 +277,7 @@
<template id="community_data_page" name="Communnity data"> <template id="community_data_page" name="Communnity data">
<t t-call="website.layout"> <t t-call="website.layout">
<div id="wrap" class="o_portal_wrap"> <div id="wrap" class="o_portal_wrap">
<div class="container oe_cooperator"> <div class="container oe_community_data">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-xs-12 col-sm-10 col-md-8 col-lg-6"> <div class="col-xs-12 col-sm-10 col-md-8 col-lg-6">
<h1 class="mt-4 text-center">Community data</h1> <h1 class="mt-4 text-center">Community data</h1>
......
...@@ -197,4 +197,24 @@ ...@@ -197,4 +197,24 @@
<img t-if="value" t-attf-src="#{value}" width="100px" /> <img t-if="value" t-attf-src="#{value}" width="100px" />
</div> </div>
</template> </template>
<template id="form_field_date_past" name="form_field_date_past">
<div
t-attf-name="#{key}_container"
t-attf-class="form-group #{error and key in error and 'has-error' or ''} field-#{key}"
>
<t t-set="date_placeholder" t-if="lang=='ca_ES'">dd/mm/aaaa</t>
<t t-set="date_placeholder" t-if="lang=='es_ES'">dd/mm/aaaa</t>
<t t-set="date_placeholder" t-if="lang=='en_US'">dd/mm/yyyy</t>
<label t-att="{'for': key}"><t t-esc="label" /></label>
<input
class="form-control form-control-sm o_website_form_date_past"
type="text"
t-attf-id="#{key}"
t-attf-name="#{key}"
t-attf-value="#{value or ''}"
t-attf-data-locale="#{lang}"
t-attf-placeholder="#{date_placeholder}"
/>
</div>
</template>
</odoo> </odoo>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment