Merge pull request #24464 from sgtpepper9907/feat-make-patient-age-translateable
feat: Make patient age translateable
This commit is contained in:
commit
6ccd64c2ec
@ -364,7 +364,7 @@ let calculate_age = function(birth) {
|
||||
let age = new Date();
|
||||
age.setTime(ageMS);
|
||||
let years = age.getFullYear() - 1970;
|
||||
return years + ' Year(s) ' + age.getMonth() + ' Month(s) ' + age.getDate() + ' Day(s)';
|
||||
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
|
||||
};
|
||||
|
||||
// List Stock items
|
||||
|
@ -258,5 +258,5 @@ var calculate_age = function (dob) {
|
||||
var age = new Date();
|
||||
age.setTime(ageMS);
|
||||
var years = age.getFullYear() - 1970;
|
||||
return years + ' Year(s) ' + age.getMonth() + ' Month(s) ' + age.getDate() + ' Day(s)';
|
||||
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
|
||||
};
|
||||
|
@ -46,11 +46,11 @@ frappe.ui.form.on('Patient', {
|
||||
}
|
||||
},
|
||||
onload: function (frm) {
|
||||
if(!frm.doc.dob){
|
||||
if (!frm.doc.dob) {
|
||||
$(frm.fields_dict['age_html'].wrapper).html('');
|
||||
}
|
||||
if(frm.doc.dob){
|
||||
$(frm.fields_dict['age_html'].wrapper).html('AGE : ' + get_age(frm.doc.dob));
|
||||
if (frm.doc.dob) {
|
||||
$(frm.fields_dict['age_html'].wrapper).html(`${__('AGE')} : ${get_age(frm.doc.dob)}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -65,7 +65,7 @@ frappe.ui.form.on('Patient', 'dob', function(frm) {
|
||||
}
|
||||
else {
|
||||
let age_str = get_age(frm.doc.dob);
|
||||
$(frm.fields_dict['age_html'].wrapper).html('AGE : ' + age_str);
|
||||
$(frm.fields_dict['age_html'].wrapper).html(`${__('AGE')} : ${age_str}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -108,7 +108,7 @@ class Patient(Document):
|
||||
if self.dob:
|
||||
dob = getdate(self.dob)
|
||||
age = dateutil.relativedelta.relativedelta(getdate(), dob)
|
||||
age_str = str(age.years) + ' year(s) ' + str(age.months) + ' month(s) ' + str(age.days) + ' day(s)'
|
||||
age_str = str(age.years) + ' ' + _("Years(s)") + ' ' + str(age.months) + ' ' + _("Month(s)") + ' ' + str(age.days) + ' ' + _("Day(s)")
|
||||
return age_str
|
||||
|
||||
def invoice_patient_registration(self):
|
||||
|
@ -596,5 +596,5 @@ let calculate_age = function(birth) {
|
||||
let age = new Date();
|
||||
age.setTime(ageMS);
|
||||
let years = age.getFullYear() - 1970;
|
||||
return years + ' Year(s) ' + age.getMonth() + ' Month(s) ' + age.getDate() + ' Day(s)';
|
||||
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
|
||||
};
|
||||
|
@ -358,5 +358,5 @@ let calculate_age = function(birth) {
|
||||
let age = new Date();
|
||||
age.setTime(ageMS);
|
||||
let years = age.getFullYear() - 1970;
|
||||
return years + ' Year(s) ' + age.getMonth() + ' Month(s) ' + age.getDate() + ' Day(s)';
|
||||
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
|
||||
};
|
||||
|
@ -36,5 +36,5 @@ var calculate_age = function(birth) {
|
||||
var age = new Date();
|
||||
age.setTime(ageMS);
|
||||
var years = age.getFullYear() - 1970;
|
||||
return years + ' Year(s) ' + age.getMonth() + ' Month(s) ' + age.getDate() + ' Day(s)';
|
||||
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user