fixes the statuslabeltypeforatter instead of the model

This commit is contained in:
Godfrey M 2023-08-14 12:13:01 -07:00
parent a0d5774635
commit 6b94ef6adc
3 changed files with 21 additions and 7 deletions

View file

@ -74,14 +74,14 @@ class Statuslabel extends SnipeModel
public function getStatuslabelType()
{
if (($this->pending == '1') && ($this->archived == '0') && ($this->deployable == '0')) {
return trans('admin/statuslabels/table.pending');
return 'pending';
} elseif (($this->pending == '0') && ($this->archived == '1') && ($this->deployable == '0')) {
return trans('admin/statuslabels/table.archived');
return 'archived';
} elseif (($this->pending == '0') && ($this->archived == '0') && ($this->deployable == '0')) {
return trans('admin/statuslabels/table.undeployable');
return 'undeployable';
}
return trans('admin/statuslabels/table.deployable');
return 'deployable';
}
/**

4
package-lock.json generated
View file

@ -17392,7 +17392,7 @@
"performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==",
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
"optional": true
},
"picocolors": {
@ -18500,7 +18500,7 @@
"rgbcolor": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/rgbcolor/-/rgbcolor-1.0.1.tgz",
"integrity": "sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw==",
"integrity": "sha1-1lBezbMEplldom+ktDMHMGd1lF0=",
"optional": true
},
"rimraf": {

View file

@ -111,25 +111,39 @@
}
function statusLabelTypeFormatter (row, value) {
switch (value.type) {
case 'deployed':
text_color = 'blue';
icon_style = 'fa-circle';
trans = '{{ strtolower(trans('general.deployed')) }}';
break;
case 'deployable':
text_color = 'green';
icon_style = 'fa-circle';
trans = '{{ strtolower(trans('admin/hardware/general.deployable')) }}';
break;
case 'pending':
text_color = 'orange';
icon_style = 'fa-circle';
trans = '{{ strtolower(trans('general.deployed')) }}';
break;
case 'undeployable':
text_color = 'orange';
icon_style = 'fa-circle';
trans ='{{ trans('admin/statuslabels/table.undeployable') }}';
break;
default:
text_color = 'red';
icon_style = 'fa-times';
trans = '{{ strtolower(trans('general.archived')) }}';
}
var typename_lower = value.type;
var typename_lower = trans;
var typename = typename_lower.charAt(0).toUpperCase() + typename_lower.slice(1);
return '<i class="fa ' + icon_style + ' text-' + text_color + '"></i> ' + typename;