minor
This commit is contained in:
parent
03dcda914a
commit
ecc514077f
@ -101,8 +101,11 @@ public function sexAge(): string
|
|||||||
{
|
{
|
||||||
$dob = $this->patient_birthdate;
|
$dob = $this->patient_birthdate;
|
||||||
$age = $dob ? (int) Carbon::make($dob)->diffInYears().'Y' : null;
|
$age = $dob ? (int) Carbon::make($dob)->diffInYears().'Y' : null;
|
||||||
|
if (blank($age) && blank($this->patient_sex)) {
|
||||||
|
return '~';
|
||||||
|
}
|
||||||
|
|
||||||
return "$age / {$this->patient_sex}";
|
return sprintf('%s / %s', $age ?? '~', $this->patient_sex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function numInstances(): string
|
public function numInstances(): string
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
use Laravel\Fortify\TwoFactorAuthenticatable;
|
use Laravel\Fortify\TwoFactorAuthenticatable;
|
||||||
use Laravel\Jetstream\HasProfilePhoto;
|
use Laravel\Jetstream\HasProfilePhoto;
|
||||||
use Laravel\Sanctum\HasApiTokens;
|
use Laravel\Sanctum\HasApiTokens;
|
||||||
@ -102,6 +103,22 @@ public function isAdmin(): bool
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isTech(): bool
|
||||||
|
{
|
||||||
|
return cache()->remember('user.is_tech:'.$this->id,
|
||||||
|
5 * 60,
|
||||||
|
fn () => $this->hasRole(UserRole::Technician)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function primaryRole(): string
|
||||||
|
{
|
||||||
|
return cache()->remember('user.pri_role:'.$this->id,
|
||||||
|
5 * 60,
|
||||||
|
fn () => Str::title($this->roles()->first()->name)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function may(Permission|iterable|string $perm): bool
|
public function may(Permission|iterable|string $perm): bool
|
||||||
{
|
{
|
||||||
return $this->isAdmin() || $this->can($perm);
|
return $this->isAdmin() || $this->can($perm);
|
||||||
@ -122,13 +139,13 @@ public function getFullNameAttribute(): string
|
|||||||
return trim($this->first_name.' '.$this->last_name);
|
return trim($this->first_name.' '.$this->last_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function avatar(): string
|
public function avatar(bool $gravatar = false): string
|
||||||
{
|
{
|
||||||
if (filled($this->profile_photo_path)) {
|
if (filled($this->profile_photo_path)) {
|
||||||
return Storage::url($this->profile_photo_path);
|
return Storage::url($this->profile_photo_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filled($this->email)) {
|
if ($gravatar && filled($this->email)) {
|
||||||
return (new Avatar)->create($this->email)->toGravatar();
|
return (new Avatar)->create($this->email)->toGravatar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
"slug": "pages-home"
|
"slug": "pages-home"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url": "/page-2",
|
"url": "/worklist",
|
||||||
"icon": "menu-icon tf-icons ri-file-line",
|
"icon": "menu-icon tf-icons ri-file-line",
|
||||||
"name": "Page 2",
|
"name": "Worklist",
|
||||||
"slug": "pages-page-2"
|
"slug": "worklist"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url": "/pages/misc-error",
|
"url": "/pages/misc-error",
|
||||||
|
@ -84,18 +84,20 @@
|
|||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<div class="flex-shrink-0 me-2">
|
<div class="flex-shrink-0 me-2">
|
||||||
<div class="avatar avatar-online">
|
<div class="avatar avatar-online">
|
||||||
<img src="{{ Auth::user() ? Auth::user()->profile_photo_url : asset('assets/img/avatars/1.png') }}" alt class="rounded-circle">
|
<img src="{{ Auth::user() ? Auth::user()->profile_photo_url : asset('assets/img/avatars/user.png') }}" alt class="rounded-circle">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-grow-1">
|
<div class="flex-grow-1">
|
||||||
<span class="fw-medium d-block small">
|
<span class="fw-medium d-block small">
|
||||||
@if (Auth::check())
|
@if (Auth::check())
|
||||||
{{ Auth::user()->name }}
|
{{ Auth::user()->display_name }}
|
||||||
@else
|
|
||||||
John Doe
|
|
||||||
@endif
|
@endif
|
||||||
</span>
|
</span>
|
||||||
<small class="text-muted">Admin</small>
|
<small class="text-muted">
|
||||||
|
@auth
|
||||||
|
{{ Auth::user()->primaryRole() }}
|
||||||
|
@endauth
|
||||||
|
</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -43,7 +43,8 @@ const FaCssFiles = GetFilesArray('resources/fontawesome/scss/!(_)*.scss');
|
|||||||
// Processing Fonts Scss Files
|
// Processing Fonts Scss Files
|
||||||
const FontsScssFiles = GetFilesArray('resources/assets/vendor/fonts/**/!(_)*.scss');
|
const FontsScssFiles = GetFilesArray('resources/assets/vendor/fonts/**/!(_)*.scss');
|
||||||
const ImageFiles = GetFilesArray('resources/imgs/**/*.*');
|
const ImageFiles = GetFilesArray('resources/imgs/**/*.*');
|
||||||
const CustImageFiles = GetFilesArray('resources/assets/img/**/*.*');
|
const CustImageFiles = GetFilesArray('resources/assets/img/customizer/*.*');
|
||||||
|
const AvImageFiles = GetFilesArray('resources/assets/img/avatars/*.*');
|
||||||
|
|
||||||
// Processing Window Assignment for Libs like jKanban, pdfMake
|
// Processing Window Assignment for Libs like jKanban, pdfMake
|
||||||
function libsWindowAssignment() {
|
function libsWindowAssignment() {
|
||||||
@ -89,6 +90,10 @@ export default defineConfig({
|
|||||||
{
|
{
|
||||||
src: [...CustImageFiles],
|
src: [...CustImageFiles],
|
||||||
dest: '../assets/img/customizer'
|
dest: '../assets/img/customizer'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: [...AvImageFiles],
|
||||||
|
dest: '../assets/img/avatars'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
|
Loading…
Reference in New Issue
Block a user