Skip to content

Commit

Permalink
Se agregaron estdisticas de vehiculos
Browse files Browse the repository at this point in the history
  • Loading branch information
mtcnxd committed Apr 26, 2024
1 parent 4f71d8b commit 35c5a10
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/ControllerAjax.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function createItemInvoice(Request $request)
$result = DB::table('services_items')->insert([
'service_id' => $request->service,
'amount' => ($labour) ? 1 : $request->amount,
'item' => ($labour) ? 'Servicio (Mano de obra)' : $request->item,
'item' => ($labour) ? 'Mano de obra' : $request->item,
'supplier' => $request->supplier,
'price' => $request->price,
'labour' => $labour,
Expand Down
9 changes: 8 additions & 1 deletion app/Http/Controllers/ControllerAutos.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@ public function index()
->where('clients.status','Activo')
->get();

# select brand, count(*) count from autos group by brand
$statistics = DB::table('autos')
->select(DB::raw('count(*) as count, brand'))
->groupBy('brand')
->get();

return view ('dashboard.autoslist', [
'autos' => $autos
'autos' => $autos,
'statistics' => $statistics,
]);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/ControllerCharts.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static function getIncomeChart()
$data = DB::select(
"select date_format(created_at,'%m') as month, sum(price) as price
from services a join services_items b on a.id = b.service_id
where labour = true group by date_format(created_at,'%m')"
where labour = true and a.status = 'Entregado' group by date_format(created_at,'%m')"
);

$months = [
Expand Down
10 changes: 8 additions & 2 deletions public/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ a:hover {

.window-title-bar {
background: var(--blue-gray-100);
padding: 10px 0 7px 15px;
padding: 10px 15px 7px 15px;
border-radius: 5px 5px 0 0;
border: solid 2px var(--blue-gray-100);
display: flex;
Expand All @@ -69,7 +69,6 @@ a:hover {
display: inline;
width: 18px;
height: 18px;
margin: 0px 20px 0px 5px;
}

.window-body {
Expand Down Expand Up @@ -121,4 +120,11 @@ a:hover {

.widget-simple-body:hover {
color: var(--orange-800);
}
.widget-simple-body::-webkit-scrollbar {
width: 4px;
height: 8px;
}
.widget-simple-body::-webkit-scrollbar-thumb {
background: #ccc;
}
25 changes: 22 additions & 3 deletions resources/views/dashboard/autoslist.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('content')
<div class="shadow-sm main-content">
<div class="window-title-bar">
<h6 class="window-title-text">Administrar autos</h6>
<h6 class="window-title-text">Buscar auto</h6>
<a href="{{ route('autos.create') }}">
<x-feathericon-truck class="window-title-icon" data-bs-toggle="tooltip" data-bs-title="Nuevo automovil" data-bs-placement="left"/>
</a>
Expand All @@ -22,6 +22,7 @@
<tr>
<th scope="col">Automovil</th>
<th scope="col" class="text-center">Año / Modelo</th>
<th scope="col">Comentario</th>
<th scope="col">Cliente</th>
<th scope="col">Placa</th>
<th scope="col" class="text-end">&nbsp;</th>
Expand All @@ -37,6 +38,7 @@
</a>
</td>
<td class="text-center">{{ $auto->year }}</td>
<td>{{ $auto->comments }}</td>
<td>
<a href="{{ route('clients.show', $auto->client_id) }}">
{{ $auto->name }}
Expand All @@ -54,6 +56,23 @@
</table>
</div>
</div>

<div class="main-content mt-4">
<div class="col-md-3">
<div class="window-body shadow-sm" style="padding: 0;">
<div class="widget-simple-body" style="max-height:180px; overflow-y:overlay;">
<ul class="list-group list-group-flush">
@foreach ($statistics as $brand)
<li class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto">{{ $brand->brand }}</div>
<span class="badge text-bg-warning rounded-pill">{{ $brand->count }}</span>
</li>
@endforeach
</ul>
</div>
</div>
</div>
</div>
@endsection

@section('css')
Expand All @@ -67,8 +86,8 @@
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl));
new DataTable('#autos', {
pageLength: 15,
lengthMenu: [15, 50, 100],
pageLength: 10,
lengthMenu: [10, 25, 50],
columnDefs: [{
orderable: false,
target: [1,3,4]
Expand Down
2 changes: 1 addition & 1 deletion resources/views/dashboard/clientslist.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="window-title-bar">
<h6 class="window-title-text">Buscar cliente</h6>
<a href="{{ route('clients.create') }}">
<x-feathericon-user-plus class="window-title-icon" data-bs-toggle="tooltip" data-bs-title="Nuevo cliente" data-bs-placement="left"/>
<x-feathericon-user-plus class="window-title-icon"/>
</a>
</div>
<div class="window-body bg-white">
Expand Down
8 changes: 4 additions & 4 deletions resources/views/dashboard/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
<div class="col-md-6 mb-4">
<div class="widget-simple">
<div class="widget-simple-head">
<span class="pt-1">Servicios Entregados</span>
<span class="pt-1">Autos Entregados</span>
<x-feathericon-tool class="window-title-icon"/>
</div>
<div class="widget-simple-body fs-3">
@php
$count = count($services);
@endphp
{{ ($count > 1) ? $count.' servicios' : $count.' servicio' }}
{{ ($count > 1) ? $count.' autos' : $count.' auto' }}
</div>
</div>
</div>
Expand Down Expand Up @@ -61,7 +61,7 @@
@endphp
@endforeach
{{ '$'.number_format($total_income,2) }}
<div class="fs-6">Servicios entregados</div>
<div class="fs-6">Autos entregados</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -105,7 +105,7 @@
<span class="pt-1">Lista servicios entregados</span>
<x-feathericon-tool class="window-title-icon"/>
</div>
<div class="widget-simple-body" style="max-height: 150px;">
<div class="widget-simple-body" style="max-height:180px; overflow-y:overlay;">
<table class="table table-sm table-striped">
@foreach ($services as $row => $service)
<tr>
Expand Down
6 changes: 5 additions & 1 deletion resources/views/dashboard/payrollslist.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@
$total = $salary->salary + ($salary->hours * $salary->price) + $salary->bonds - $salary->discount;
@endphp
<tr>
<td>{{ $salary->name }}</td>
<td>
<span class="material-symbols-outlined" style="position:relative; top:5px; margin-right:6px;">badge</span>
{{ $salary->name }}
</td>
<td>
<a href="http://">
{{ Carbon\Carbon::parse($salary->created_at)->format('d-m-Y') }}
Expand Down Expand Up @@ -108,6 +111,7 @@

@section('css')
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.7/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" />
@endsection

@section('js')
Expand Down

0 comments on commit 35c5a10

Please sign in to comment.