feat: Make patient age translateable
This commit is contained in:
parent
fa3ec3c346
commit
e1e4810a46
@ -364,7 +364,7 @@ let calculate_age = function(birth) {
|
|||||||
let age = new Date();
|
let age = new Date();
|
||||||
age.setTime(ageMS);
|
age.setTime(ageMS);
|
||||||
let years = age.getFullYear() - 1970;
|
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
|
// List Stock items
|
||||||
|
|||||||
@ -258,5 +258,5 @@ var calculate_age = function (dob) {
|
|||||||
var age = new Date();
|
var age = new Date();
|
||||||
age.setTime(ageMS);
|
age.setTime(ageMS);
|
||||||
var years = age.getFullYear() - 1970;
|
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)')}`;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -50,7 +50,7 @@ frappe.ui.form.on('Patient', {
|
|||||||
$(frm.fields_dict['age_html'].wrapper).html('');
|
$(frm.fields_dict['age_html'].wrapper).html('');
|
||||||
}
|
}
|
||||||
if(frm.doc.dob){
|
if(frm.doc.dob){
|
||||||
$(frm.fields_dict['age_html'].wrapper).html('AGE : ' + get_age(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 {
|
else {
|
||||||
let age_str = get_age(frm.doc.dob);
|
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 {
|
else {
|
||||||
|
|||||||
@ -108,7 +108,7 @@ class Patient(Document):
|
|||||||
if self.dob:
|
if self.dob:
|
||||||
dob = getdate(self.dob)
|
dob = getdate(self.dob)
|
||||||
age = dateutil.relativedelta.relativedelta(getdate(), 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
|
return age_str
|
||||||
|
|
||||||
def invoice_patient_registration(self):
|
def invoice_patient_registration(self):
|
||||||
|
|||||||
@ -596,5 +596,5 @@ let calculate_age = function(birth) {
|
|||||||
let age = new Date();
|
let age = new Date();
|
||||||
age.setTime(ageMS);
|
age.setTime(ageMS);
|
||||||
let years = age.getFullYear() - 1970;
|
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();
|
let age = new Date();
|
||||||
age.setTime(ageMS);
|
age.setTime(ageMS);
|
||||||
let years = age.getFullYear() - 1970;
|
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();
|
var age = new Date();
|
||||||
age.setTime(ageMS);
|
age.setTime(ageMS);
|
||||||
var years = age.getFullYear() - 1970;
|
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