mirror of
https://github.com/grocy/grocy.git
synced 2025-04-28 17:23:56 +00:00
* Replaced timeago with moment.fromNow * Fixed datetime when best_before_date is empty * Removed the now unnecessary timeago package * Removed not longer localization strings * Check for empty instead of string comparison Co-authored-by: Bernd Bestel <bernd@berrnd.de>
27 lines
1.1 KiB
JavaScript
27 lines
1.1 KiB
JavaScript
Grocy.Components.BatteryCard = {};
|
|
|
|
Grocy.Components.BatteryCard.Refresh = function(batteryId)
|
|
{
|
|
Grocy.Api.Get('batteries/' + batteryId,
|
|
function(batteryDetails)
|
|
{
|
|
$('#batterycard-battery-name').text(batteryDetails.battery.name);
|
|
$('#batterycard-battery-used_in').text(batteryDetails.battery.used_in);
|
|
$('#batterycard-battery-last-charged').text((batteryDetails.last_charged || __t('never')));
|
|
$('#batterycard-battery-last-charged-timeago').attr("datetime", batteryDetails.last_charged || '');
|
|
$('#batterycard-battery-charge-cycles-count').text((batteryDetails.charge_cycles_count || '0'));
|
|
|
|
$('#batterycard-battery-edit-button').attr("href", U("/battery/" + batteryDetails.battery.id.toString()));
|
|
$('#batterycard-battery-journal-button').attr("href", U("/batteriesjournal?embedded&battery=" + batteryDetails.battery.id.toString()));
|
|
$('#batterycard-battery-edit-button').removeClass("disabled");
|
|
$('#batterycard-battery-journal-button').removeClass("disabled");
|
|
|
|
RefreshContextualTimeago(".batterycard");
|
|
},
|
|
function(xhr)
|
|
{
|
|
console.error(xhr);
|
|
}
|
|
);
|
|
};
|