mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms: added new checkin partner fields in precheckin portal
This commit is contained in:
@@ -1201,7 +1201,6 @@ class TestPmsCheckinPartner(TestPms):
|
||||
is = 20 years old and document_date = today + 1 year. The expected
|
||||
expedition date has to be doc_date - 5 years
|
||||
"""
|
||||
doc_type_id = self.env["res.partner.id_category"].search([("code", "=", "D")])
|
||||
doc_date = fields.date.today() + datetime.timedelta(days=366)
|
||||
doc_date_str = str(doc_date)
|
||||
|
||||
@@ -1213,7 +1212,7 @@ class TestPmsCheckinPartner(TestPms):
|
||||
expected_exp_date = doc_date - datetime.timedelta(days=1826.25)
|
||||
expedition_date = (
|
||||
self.checkin1.calculate_doc_type_expedition_date_from_validity_date(
|
||||
doc_type_id, doc_date_str, birthdate_str
|
||||
self.id_category, doc_date_str, birthdate_str
|
||||
)
|
||||
)
|
||||
date_expedition_date = datetime.date(
|
||||
@@ -1238,7 +1237,6 @@ class TestPmsCheckinPartner(TestPms):
|
||||
is = 40 years old and document_date = today + 1 year. The expected
|
||||
expedition date has to be doc_date - 10 years
|
||||
"""
|
||||
doc_type_id = self.env["res.partner.id_category"].search([("code", "=", "D")])
|
||||
doc_date = fields.date.today() + datetime.timedelta(days=366)
|
||||
doc_date_str = str(doc_date)
|
||||
|
||||
@@ -1250,7 +1248,7 @@ class TestPmsCheckinPartner(TestPms):
|
||||
expected_exp_date = doc_date - datetime.timedelta(days=3652.5)
|
||||
expedition_date = (
|
||||
self.checkin1.calculate_doc_type_expedition_date_from_validity_date(
|
||||
doc_type_id, doc_date_str, birthdate_str
|
||||
self.id_category, doc_date_str, birthdate_str
|
||||
)
|
||||
)
|
||||
date_expedition_date = datetime.date(
|
||||
@@ -1275,7 +1273,6 @@ class TestPmsCheckinPartner(TestPms):
|
||||
is = 20 years old and document_date = today + 1 year. The expected
|
||||
expedition date has to be doc_date - 5 years
|
||||
"""
|
||||
doc_type_id = self.env["res.partner.id_category"].search([("code", "=", "P")])
|
||||
doc_date = fields.date.today() + datetime.timedelta(days=366)
|
||||
doc_date_str = str(doc_date)
|
||||
|
||||
@@ -1287,7 +1284,7 @@ class TestPmsCheckinPartner(TestPms):
|
||||
expected_exp_date = doc_date - datetime.timedelta(days=1826.25)
|
||||
expedition_date = (
|
||||
self.checkin1.calculate_doc_type_expedition_date_from_validity_date(
|
||||
doc_type_id, doc_date_str, birthdate_str
|
||||
self.id_category, doc_date_str, birthdate_str
|
||||
)
|
||||
)
|
||||
date_expedition_date = datetime.date(
|
||||
@@ -1436,7 +1433,7 @@ class TestPmsCheckinPartner(TestPms):
|
||||
"firstname": "Serafín",
|
||||
"lastname": "Rivas",
|
||||
"lastname2": "Gonzalez",
|
||||
"document_type": self.id_category.name,
|
||||
"document_type": self.id_category.code,
|
||||
"document_number": "18038946T",
|
||||
"document_expedition_date": "2015-10-07",
|
||||
"birthdate_date": "1983-10-05",
|
||||
|
||||
@@ -273,6 +273,25 @@
|
||||
/>
|
||||
</t>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-12 col-md-6 pt-md-5">
|
||||
<label
|
||||
id="label_phone"
|
||||
class="col-form-label"
|
||||
for="phone"
|
||||
>Phone</label>
|
||||
<input
|
||||
type="phone"
|
||||
name="phone"
|
||||
t-attf-class="form-control #{error.get('email') and 'is-invalid' or ''}"
|
||||
t-att-value="checkin_partner_id.phone"
|
||||
/>
|
||||
<t t-if="error_message">
|
||||
<span
|
||||
class="text-danger"
|
||||
t-esc="error_message.get('phone')"
|
||||
/>
|
||||
</t>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-12 col-md-6 pt-md-5">
|
||||
<label
|
||||
id="label_email"
|
||||
@@ -292,6 +311,103 @@
|
||||
/>
|
||||
</t>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-12 col-md-6 pt-md-5">
|
||||
<label
|
||||
id="label_relationship"
|
||||
class="col-form-label"
|
||||
for="partner_relationship"
|
||||
>Partner Relationship</label>
|
||||
<input
|
||||
type="text"
|
||||
name="partner_relationship"
|
||||
t-attf-class="form-control #{error.get('email') and 'is-invalid' or ''}"
|
||||
t-att-value="checkin_partner_id.partner_relationship"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-md-12 pt-md-5 ">
|
||||
<b>Residence Address</b>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-md-12">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Street"
|
||||
name="residence_street"
|
||||
t-attf-class="form-control #{error.get('email') and 'is-invalid' or ''}"
|
||||
t-att-value="checkin_partner_id.residence_street"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-md-12">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Second Street"
|
||||
name="residence_street2"
|
||||
t-attf-class="form-control #{error.get('email') and 'is-invalid' or ''}"
|
||||
t-att-value="checkin_partner_id.residence_street2"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-md-4">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="City"
|
||||
name="residence_city"
|
||||
t-attf-class="form-control #{error.get('email') and 'is-invalid' or ''}"
|
||||
t-att-value="checkin_partner_id.residence_city"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-md-4">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Zip"
|
||||
name="residence_zip"
|
||||
t-attf-class="form-control #{error.get('email') and 'is-invalid' or ''}"
|
||||
t-att-value="checkin_partner_id.residence_zip"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-md-4">
|
||||
<select
|
||||
class="form-control"
|
||||
id="residence-country"
|
||||
name='residence_country_id'
|
||||
onclick="changeCountryFormClass()"
|
||||
>
|
||||
<option
|
||||
id="country_placeholder"
|
||||
hidden="1"
|
||||
value="placeholder"
|
||||
>Country</option>
|
||||
<t t-foreach="country_ids" t-as='country_id'>
|
||||
<option
|
||||
t-att-value="country_id.id"
|
||||
t-att-selected="country_id.id == checkin_partner_id.residence_country_id.id if checkin_partner_id.residence_country_id.id else placeholder"
|
||||
>
|
||||
<t t-esc='country_id.name' />
|
||||
</option>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-md-12">
|
||||
<select
|
||||
class="form-control"
|
||||
id="residence-state"
|
||||
name='residence_state_id'
|
||||
onclick="changeFormClass()"
|
||||
>
|
||||
<option
|
||||
id="placeholder"
|
||||
hidden="1"
|
||||
value="placeholder"
|
||||
>State</option>
|
||||
<t t-foreach="state_ids" t-as='state'>
|
||||
<option
|
||||
t-att-value="state.id"
|
||||
t-att-country_id="state.country_id.id"
|
||||
t-att-selected="state.id == checkin_partner_id.residence_state_id.id if checkin_partner_id.residence_state_id.id else placeholder"
|
||||
>
|
||||
<t t-esc="state.name" />
|
||||
</option>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
<t t-if="checkin_pos >= 0">
|
||||
<div class="col-4">
|
||||
<t t-if="not error">
|
||||
@@ -410,8 +526,69 @@
|
||||
from {top: 100px; opacity: 1;}
|
||||
to {top: 0; opacity: 0;}
|
||||
}
|
||||
|
||||
.placeholder-class{
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: calc(1.5em + 0.75rem + 2px);
|
||||
padding: 0.375rem 0.75rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 400;
|
||||
line-height: 1.5;
|
||||
color: grey;
|
||||
background-color: #FFFFFF;
|
||||
background-clip: padding-box;
|
||||
border: 1px solid #CED4DA;
|
||||
border-radius: 0.25rem;
|
||||
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var placeholder_country = document.getElementById("country_placeholder")
|
||||
function changeCountryFormClass() {
|
||||
let select_value = placeholder_country.parentNode.value
|
||||
if (placeholder_country.parentNode.value == 'placeholder'){
|
||||
placeholder_country.parentNode.classList.add('placeholder-class')
|
||||
}else{
|
||||
placeholder_country.parentNode.classList.remove('placeholder-class')
|
||||
}
|
||||
};
|
||||
this.changeCountryFormClass()
|
||||
|
||||
var placeholder = document.getElementById("placeholder")
|
||||
function changeFormClass() {
|
||||
let select_value = placeholder.parentNode.value
|
||||
if (placeholder.parentNode.value == 'placeholder'){
|
||||
placeholder.parentNode.classList.remove('form-control')
|
||||
placeholder.parentNode.classList.add('placeholder-class')
|
||||
}else{
|
||||
placeholder.parentNode.classList.remove('placeholder-class')
|
||||
placeholder.parentNode.classList.add('form-control')
|
||||
}
|
||||
};
|
||||
this.changeFormClass()
|
||||
|
||||
let select_residence_country = document.getElementById('residence-country')
|
||||
|
||||
select_residence_country.addEventListener("change", () => {
|
||||
let country_value = select_residence_country.value
|
||||
Array.from(document.getElementById('residence-state').options).forEach(element => {
|
||||
if (element.getAttribute('country_id') == country_value) {
|
||||
element.style="";
|
||||
} else {
|
||||
element.style="display:none";
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var select_doc_type = document.getElementById("doc_type")
|
||||
var document_type_value = document.getElementById("docTypeId").textContent
|
||||
for (let i=0;i<select_doc_type.length;i++){
|
||||
if (select_doc_type[i].value == document_type_value){
|
||||
select_doc_type[i].setAttribute("selected","True")
|
||||
}
|
||||
}
|
||||
|
||||
var folio_id = document.getElementById("folio").value
|
||||
var checkin_partner_id = document.getElementById("checkin").value
|
||||
var access_token = document.getElementById("input_access_token").value
|
||||
|
||||
Reference in New Issue
Block a user