mirror of
https://github.com/grocy/grocy.git
synced 2025-08-19 03:40:10 +00:00
Finalize project reorganization
This commit is contained in:
20
public/viewjs/components/batterycard.js
Normal file
20
public/viewjs/components/batterycard.js
Normal file
@@ -0,0 +1,20 @@
|
||||
Grocy.Components.BatteryCard = { };
|
||||
|
||||
Grocy.Components.BatteryCard.Refresh = function(batteryId)
|
||||
{
|
||||
Grocy.FetchJson('/api/batteries/get-battery-details/' + batteryId,
|
||||
function(batteryDetails)
|
||||
{
|
||||
$('#batterycard-battery-name').text(batteryDetails.battery.name);
|
||||
$('#batterycard-battery-last-charged').text((batteryDetails.last_charged || 'never'));
|
||||
$('#batterycard-battery-last-charged-timeago').text($.timeago(batteryDetails.last_charged || ''));
|
||||
$('#batterycard-battery-charge-cycles-count').text((batteryDetails.charge_cycles_count || '0'));
|
||||
|
||||
EmptyElementWhenMatches('#batterycard-battery-last-charged-timeago', 'NaN years ago');
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
};
|
Reference in New Issue
Block a user