diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3fea7dcf..40d9d307 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,11 +1,11 @@ name: Deploy OSLab - on: workflow_run: workflows: ["OSLab Laravel Application Test"] types: - completed + jobs: deploy: runs-on: self-hosted @@ -20,6 +20,28 @@ jobs: cd /var/Docker/Docker_Dev_Web/www/oslab git pull origin main + - name: Gerar e Injetar Versão no .env + run: | + # Define o caminho real do projeto no servidor + PROJECT_PATH="/var/Docker/Docker_Dev_Web/www/oslab" + + # Lê a base do arquivo version.env recém atualizado + BASE=$(grep -E "^BASE_VERSION=" $PROJECT_PATH/version.env | cut -d '=' -f2 | tr -d '\r') + + # Dados para a versão visual e URL + BRANCH=${{ github.ref_name }} + SHORT_HASH=$(echo ${{ github.sha }} | cut -c1-7) + FULL_HASH=${{ github.sha }} + REPO=${{ github.repository }} + + # Remove as linhas das versões antigas do .env de produção para não duplicar + sed -i '/^APP_VERSION=/d' $PROJECT_PATH/.env + sed -i '/^APP_VERSION_URL=/d' $PROJECT_PATH/.env + + # Salva a nova versão no .env real do servidor + echo "APP_VERSION=${BASE}-${BRANCH}-${SHORT_HASH}" >> $PROJECT_PATH/.env + echo "APP_VERSION_URL=https://github.com/${REPO}/commit/${FULL_HASH}" >> $PROJECT_PATH/.env + - name: Rodar Composer dentro do diretório Oslab run: | sudo docker exec app composer install -d oslab @@ -28,10 +50,10 @@ jobs: run: | sudo docker exec app php oslab/artisan migrate - - name: Limpando cache de configuração - run: | - sudo docker exec app php oslab/artisan optimize:clear - - name: Rodar Artisan db:update-defaults (chamando direto na classe) run: | sudo docker exec app php oslab/artisan db:seed --class DatabaseDefaultPermissionsUpdate + + - name: Limpando cache de configuração (Agora lendo o .env novo) + run: | + sudo docker exec app php oslab/artisan optimize:clear diff --git a/README.md b/README.md index 39b88d74..8f445754 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![OSLab](https://raw.githubusercontent.com/bulfaitelo/oslab/main/public/vendor/oslab/imgs/oslab_logo_marca.png)]() -[![Version](https://img.shields.io/badge/version-0.0.1-blue.svg?longCache=true&style=flat-square)]() +[![Version](https://img.shields.io/badge/version-0.1.0-blue.svg?longCache=true&style=flat-square)]() [![Issues](https://img.shields.io/github/issues/bulfaitelo/oslab.svg?longCache=true&style=flat-square)](https://github.com/bulfaitelo/OSLab/issues) [![GitHub branch check runs](https://img.shields.io/github/check-runs/bulfaitelo/OSLab/main?logo=github-actions&logoColor=white&style=flat-square)](https://github.com/bulfaitelo/oslab/actions) [![StyleCI](https://github.styleci.io/repos/642922269/shield?branch=main)](https://github.styleci.io/repos/642922269) diff --git a/app/Http/Controllers/Configuracao/PaginaFavoritaController.php b/app/Http/Controllers/Configuracao/PaginaFavoritaController.php new file mode 100644 index 00000000..efc85a01 --- /dev/null +++ b/app/Http/Controllers/Configuracao/PaginaFavoritaController.php @@ -0,0 +1,94 @@ +middleware('permission:config_pagina_favorita', ['only' => ['index', 'update', 'destroy', 'updateOrder', 'edit']]); + } + + /** + * Display a listing of the resource. + */ + public function index() + { + $user = Auth::user(); + $favoritas = PaginaFavorita::where('user_id', $user->id) + ->orderBy('order') + ->get(); + + return view('configuracao.pagina-favorita.index', [ + 'favoritas' => $favoritas, + 'colors' => PaginaFavorita::AVAILABLE_COLORS, + ]); + } + + /** + * Show the form for editing the specified resource. + */ + public function edit(PaginaFavorita $paginaFavorita) + { + $this->authorize('update', $paginaFavorita); + + return view('configuracao.pagina-favorita.edit', [ + 'favorita' => $paginaFavorita, + 'colors' => PaginaFavorita::AVAILABLE_COLORS, + ]); + } + + /** + * Update the specified resource in storage. + */ + public function update(Request $request, PaginaFavorita $paginaFavorita) + { + $this->authorize('update', $paginaFavorita); + + $validated = $request->validate([ + 'text' => 'required|string|max:255', + 'color' => 'required|in:'.implode(',', array_keys(PaginaFavorita::AVAILABLE_COLORS)), + ]); + + $paginaFavorita->update($validated); + + return redirect()->route('configuracao.pagina-favorita.index') + ->with('success', 'Página favorita atualizada com sucesso!'); + } + + /** + * Remove the specified resource from storage. + */ + public function destroy(PaginaFavorita $paginaFavorita) + { + $this->authorize('delete', $paginaFavorita); + + $paginaFavorita->delete(); + + return redirect()->route('configuracao.pagina-favorita.index') + ->with('success', 'Página favorita removida com sucesso!'); + } + + /** + * Update the order of favorites via AJAX. + */ + public function updateOrder(Request $request) + { + $user = Auth::user(); + $order = $request->input('order', []); + + foreach ($order as $index => $id) { + PaginaFavorita::where('id', $id) + ->where('user_id', $user->id) + ->update(['order' => $index]); + } + + return response()->json(['success' => true]); + } +} diff --git a/app/Http/Controllers/Configuracao/Parametro/CategoriaController.php b/app/Http/Controllers/Configuracao/Parametro/CategoriaController.php index 104354cf..9e871640 100644 --- a/app/Http/Controllers/Configuracao/Parametro/CategoriaController.php +++ b/app/Http/Controllers/Configuracao/Parametro/CategoriaController.php @@ -14,7 +14,7 @@ public function __construct() // ACL DE PERMISSÕES $this->middleware('permission:config_categoria', ['only' => 'index']); $this->middleware('permission:config_categoria_create', ['only' => ['create', 'store']]); - $this->middleware('permission:config_categoria_show', ['only' => 'show']); + $this->middleware('permission:config_categoria_show', ['only' => ['show', 'getDadosCategoria']]); $this->middleware('permission:config_categoria_edit', ['only' => ['edit', 'update']]); $this->middleware('permission:config_categoria_destroy', ['only' => 'destroy']); } @@ -47,7 +47,11 @@ public function store(StoreUpdateCategoriaRequest $request) try { $categoria = new Categoria; $categoria->name = $request->name; + $categoria->descricao_categoria = $request->descricao_categoria; $categoria->descricao = $request->descricao; + $categoria->defeito = $request->defeito; + $categoria->observacao = $request->observacao; + $categoria->laudo = $request->laudo; $categoria->user_id = Auth::id(); $categoria->garantia_id = $request->garantia_id; $categoria->centro_custo_id = $request->centro_custo_id; @@ -85,7 +89,11 @@ public function update(StoreUpdateCategoriaRequest $request, Categoria $categori { try { $categoria->name = $request->name; + $categoria->descricao_categoria = $request->descricao_categoria; $categoria->descricao = $request->descricao; + $categoria->defeito = $request->defeito; + $categoria->observacao = $request->observacao; + $categoria->laudo = $request->laudo; $categoria->user_id = Auth::id(); $categoria->garantia_id = $request->garantia_id; $categoria->centro_custo_id = $request->centro_custo_id; @@ -114,4 +122,21 @@ public function destroy(Categoria $categoria) throw $th; } } + + /** + * Retorna os dados da categoria em formato JSON. + */ + public function getDadosCategoria(Categoria $categoria) + { + try { + return response()->json([ + 'descricao' => $categoria->descricao, + 'defeito' => $categoria->defeito, + 'observacao' => $categoria->observacao, + 'laudo' => $categoria->laudo, + ], 200); + } catch (\Throwable $th) { + return response()->json(['error' => 'Dados não encontrados'], 404); + } + } } diff --git a/app/Http/Controllers/Configuracao/Wiki/ModeloController.php b/app/Http/Controllers/Configuracao/Wiki/ModeloController.php index 925a7be4..c80ef25c 100644 --- a/app/Http/Controllers/Configuracao/Wiki/ModeloController.php +++ b/app/Http/Controllers/Configuracao/Wiki/ModeloController.php @@ -14,7 +14,7 @@ class ModeloController extends Controller public function __construct() { // ACL DE PERMISSÕES - $this->middleware('permission:config_wiki_modelo', ['only' => ['index', 'apiModeloSelect']]); + $this->middleware('permission:config_wiki_modelo', ['only' => ['index', 'apiModeloSelect', 'getCategoriaByModelo']]); $this->middleware('permission:config_wiki_modelo_create', ['only' => ['create', 'store']]); $this->middleware('permission:config_wiki_modelo_show', ['only' => 'show']); $this->middleware('permission:config_wiki_modelo_edit', ['only' => ['edit', 'update']]); @@ -146,4 +146,25 @@ public function apiModeloSelect(Request $request) return response()->json($th, 403); } } + + /** + * Get Categoria by Modelo. + * + * Retorna a categoria associada ao modelo selecionado. + * + * @return response, json Retorna a categoria do modelo + **/ + public function getCategoriaByModelo(Modelo $modelo) + { + try { + $categoria = $modelo->wiki->categoria; + + return response()->json([ + 'id' => $categoria->id, + 'name' => $categoria->name, + ], 200); + } catch (\Throwable $th) { + return response()->json(['error' => 'Categoria não encontrada'], 404); + } + } } diff --git a/app/Http/Controllers/Os/OsController.php b/app/Http/Controllers/Os/OsController.php index 2538a229..72beabcd 100644 --- a/app/Http/Controllers/Os/OsController.php +++ b/app/Http/Controllers/Os/OsController.php @@ -93,7 +93,6 @@ public function printPdf(Os $os) $pdf = Pdf::loadView('os.pdf.print', compact('os', 'emitente')); // $pdf->setWarnings(true); $pdf->setPaper('a4'); - // $css = asset('vendor/adminlte/dist/css/adminlte.min.css'); return $pdf->stream('OSLab_OS_'.$os->id.'_'.$os->cliente->titleName().'.pdf'); } diff --git a/app/Http/Controllers/Os/OsPublicController.php b/app/Http/Controllers/Os/OsPublicController.php index 15f7a155..09b3f1e8 100644 --- a/app/Http/Controllers/Os/OsPublicController.php +++ b/app/Http/Controllers/Os/OsPublicController.php @@ -33,6 +33,7 @@ public function update($uuid, Request $request) // dd($request->input()); try { $informacao->informacao = $request->informacao; + $informacao->usuario = $request->usuario; $informacao->descricao = $request->descricao; $informacao->uuid = null; $informacao->status = 3; diff --git a/app/Http/Controllers/Relatorio/Sistema/AuditoriaController.php b/app/Http/Controllers/Relatorio/Sistema/AuditoriaController.php new file mode 100644 index 00000000..20284f56 --- /dev/null +++ b/app/Http/Controllers/Relatorio/Sistema/AuditoriaController.php @@ -0,0 +1,88 @@ +middleware('permission:relatorio_sistema_auditoria', ['only' => ['index', 'show']]); + } + + /** + * Display a listing of the audit records. + */ + public function index(Request $request) + { + $auditorias = Audit::query(); + $auditorias->with('user'); + + // Filtro por modelo + if ($request->filled('auditable_type')) { + $auditorias->where('auditable_type', $request->auditable_type); + } + + // Filtro por tipo de evento + if ($request->filled('event')) { + $auditorias->where('event', $request->event); + } + + // Filtro por usuário + if ($request->filled('user_id')) { + $auditorias->where('user_id', $request->user_id); + } + + // Filtro por ID do registro auditado + if ($request->filled('auditable_id')) { + $auditorias->where('auditable_id', $request->auditable_id); + } + + // Filtro por data + if ($request->filled('data_inicio')) { + $auditorias->whereDate('created_at', '>=', $request->data_inicio); + } + + if ($request->filled('data_fim')) { + $auditorias->whereDate('created_at', '<=', $request->data_fim); + } + + // Ordenação padrão + $auditorias = $auditorias->latest('created_at')->paginate(50); + + // Obter lista de modelos auditados para o filtro + $modelos = Audit::select('auditable_type') + ->distinct() + ->orderBy('auditable_type') + ->pluck('auditable_type') + ->toArray(); + + $modelos = collect($modelos) + ->mapWithKeys(fn ($type) => [$type => class_basename($type)]) + ->all(); + + // Obter lista de usuários + $usuarios = \App\Models\User::orderBy('name')->pluck('name', 'id'); + + return view('relatorio.sistema.auditoria.index', [ + 'auditorias' => $auditorias, + 'request' => $request, + 'modelos' => $modelos, + 'usuarios' => $usuarios, + ]); + } + + /** + * Display the specified audit record. + */ + public function show(Audit $auditoria) + { + return view('relatorio.sistema.auditoria.show', [ + 'auditoria' => $auditoria, + ]); + } +} diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index 3391630e..6ca279d0 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -12,7 +12,9 @@ class TrustProxies extends Middleware * * @var array|string|null */ - protected $proxies; + // protected $proxies; + + protected $proxies = '*'; /** * The headers that should be used to detect proxies. diff --git a/app/Livewire/Os/CopyToWhatsappButton.php b/app/Livewire/Os/CopyToWhatsappButton.php new file mode 100644 index 00000000..72624a89 --- /dev/null +++ b/app/Livewire/Os/CopyToWhatsappButton.php @@ -0,0 +1,143 @@ +dispatch('registerCopyListener'); + } + + /** + * Gera o texto formatado para copiar para WhatsApp. + */ + public function getWhatsappText(): string + { + $text = ''; + + if (Emitente::first()->fantasia) { + $text .= '*'.Emitente::first()->fantasia."*\n"; + } else { + $text .= '*'.Emitente::first()->name."*\n"; + } + // Número da OS + $text .= '*OS #'.str_pad($this->os->id, 5, '0', STR_PAD_LEFT)."*\n"; + + // Cliente + if ($this->os->cliente) { + $clienteName = substr($this->os->cliente->name, 0, 50); + $text .= '*Cliente:* '.$clienteName."\n"; + } + + // Emitente (Técnico) + if ($this->os->tecnico) { + $tecnicoName = substr($this->os->tecnico->name, 0, 50); + $text .= '*Técnico:* '.$tecnicoName."\n"; + } + + // Status + if ($this->os->status) { + $text .= '*Status:* '.$this->os->status->name."\n"; + } + + // // Categoria + // if ($this->os->categoria) { + // $text .= 'Categoria: '.$this->os->categoria->name."\n"; + // } + + $text .= "\n*PRODUTOS E SERVIÇOS*\n"; + + // Produtos + $produtos = $this->os->produtos()->get(); + if ($produtos->count() > 0) { + foreach ($produtos as $produto) { + $nomeProd = substr($produto->produto->name, 0, 40); + $qty = $produto->quantidade; + $valor = number_format($produto->valor_venda, 2, ',', '.'); + $text .= '• '.$nomeProd.' x'.$qty.' - R$ '.$valor."\n"; + } + } + + // Serviços + $servicos = $this->os->servicos()->get(); + if ($servicos->count() > 0) { + foreach ($servicos as $servico) { + $nomeServ = substr($servico->servico->name, 0, 40); + $qty = $servico->quantidade; + $valor = number_format($servico->valor_servico, 2, ',', '.'); + $text .= '• '.$nomeServ.' x'.$qty.' - R$ '.$valor."\n"; + } + } + + // Valor Total + if ($this->os->valorTotal()) { + $totalFormatado = number_format($this->os->valorTotal(), 2, ',', '.'); + $text .= "\n*Total: R$ ".$totalFormatado."*\n"; + } + + // Seção de Informações Adicionais (sem limite) + // $temInfoAdicional = false; + + // if ($this->os->descricao && trim($this->os->descricao) !== '') { + // if (! $temInfoAdicional) { + // $text .= "\n*INFORMAÇÕES ADICIONAIS*\n"; + // $temInfoAdicional = true; + // } + // $text .= "\n*Descrição:*\n".trim($this->os->descricao); + // } + + // if ($this->os->defeito && trim($this->os->defeito) !== '') { + // if (! $temInfoAdicional) { + // $text .= "\n*INFORMAÇÕES ADICIONAIS*\n"; + // $temInfoAdicional = true; + // } else { + // $text .= "\n"; + // } + // $text .= "\n*Defeito:*\n".trim($this->os->defeito); + // } + + // if ($this->os->observacoes && trim($this->os->observacoes) !== '') { + // if (! $temInfoAdicional) { + // $text .= "\n*INFORMAÇÕES ADICIONAIS*\n"; + // $temInfoAdicional = true; + // } else { + // $text .= "\n"; + // } + // $text .= "\n*Anotação:*\n".trim($this->os->observacoes); + // } + + // if ($this->os->laudo && trim($this->os->laudo) !== '') { + // if (! $temInfoAdicional) { + // $text .= "\n*INFORMAÇÕES ADICIONAIS*\n"; + // $temInfoAdicional = true; + // } else { + // $text .= "\n"; + // } + // $text .= "\n*Laudo:*\n".trim($this->os->laudo); + // } + + return $text; + } + + /** + * Action para copiar o texto para a área de transferência via JS. + */ + public function copyToClipboard() + { + $this->dispatch('copyToClipboard', $this->getWhatsappText()); + flash('Texto copiado para a área de transferência!'); + } +} diff --git a/app/Livewire/Os/InformacoesTab.php b/app/Livewire/Os/InformacoesTab.php index 8b8a1f2e..2b33b3f8 100644 --- a/app/Livewire/Os/InformacoesTab.php +++ b/app/Livewire/Os/InformacoesTab.php @@ -19,6 +19,8 @@ class InformacoesTab extends Component public $os; + public $usuario_senha; + public $descricao_senha; public $tipo_senha = 'texto'; @@ -87,6 +89,7 @@ public function senhaCreate(): void $this->os->informacoes()->create([ 'user_id' => Auth::id(), 'descricao' => $this->descricao_senha, + 'usuario' => $this->usuario_senha, 'tipo' => 2, 'tipo_informacao' => $this->tipo_senha, 'informacao' => $infomacao, diff --git a/app/Models/Checklist/Checklist.php b/app/Models/Checklist/Checklist.php index 2ced28b8..97e6e6a9 100644 --- a/app/Models/Checklist/Checklist.php +++ b/app/Models/Checklist/Checklist.php @@ -7,10 +7,12 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use OwenIt\Auditing\Contracts\Auditable; -class Checklist extends Model +class Checklist extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; public function categoria(): BelongsTo { diff --git a/app/Models/Cliente/Cliente.php b/app/Models/Cliente/Cliente.php index b169d2e8..404237ae 100644 --- a/app/Models/Cliente/Cliente.php +++ b/app/Models/Cliente/Cliente.php @@ -9,10 +9,12 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use OwenIt\Auditing\Contracts\Auditable; -class Cliente extends Model +class Cliente extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; /** * The attributes that should be cast. diff --git a/app/Models/Configuracao/Garantia/Garantia.php b/app/Models/Configuracao/Garantia/Garantia.php index 764b51d6..6cf08bd7 100644 --- a/app/Models/Configuracao/Garantia/Garantia.php +++ b/app/Models/Configuracao/Garantia/Garantia.php @@ -5,10 +5,12 @@ use App\Models\User; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use OwenIt\Auditing\Contracts\Auditable; -class Garantia extends Model +class Garantia extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; /** * Retorna o nome do usuário. diff --git a/app/Models/Configuracao/Parametro/Categoria.php b/app/Models/Configuracao/Parametro/Categoria.php index 239ecc63..02dfa4d8 100644 --- a/app/Models/Configuracao/Parametro/Categoria.php +++ b/app/Models/Configuracao/Parametro/Categoria.php @@ -7,10 +7,30 @@ use App\Models\Configuracao\Garantia\Garantia; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use OwenIt\Auditing\Contracts\Auditable; -class Categoria extends Model +class Categoria extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; + + /** + * Os atributos que são atribuíveis em massa. + * + * @var array + */ + protected $fillable = [ + 'name', + 'descricao', + 'defeito', + 'observacao', + 'laudo', + 'user_id', + 'garantia_id', + 'centro_custo_id', + 'checklist_id', + 'checklist_required', + ]; /** * Retorna a garantia. diff --git a/app/Models/Configuracao/Parametro/Status.php b/app/Models/Configuracao/Parametro/Status.php index 2fd02829..05f798c1 100644 --- a/app/Models/Configuracao/Parametro/Status.php +++ b/app/Models/Configuracao/Parametro/Status.php @@ -8,10 +8,12 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; +use OwenIt\Auditing\Contracts\Auditable; -class Status extends Model +class Status extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; protected $table = 'status'; diff --git a/app/Models/Configuracao/Sistema/SistemaConfig.php b/app/Models/Configuracao/Sistema/SistemaConfig.php index 9d579748..275100cb 100644 --- a/app/Models/Configuracao/Sistema/SistemaConfig.php +++ b/app/Models/Configuracao/Sistema/SistemaConfig.php @@ -4,10 +4,12 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use OwenIt\Auditing\Contracts\Auditable; -class SistemaConfig extends Model +class SistemaConfig extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; protected $fillable = [ 'key', diff --git a/app/Models/Financeiro/Contas.php b/app/Models/Financeiro/Contas.php index d20d8ac8..89f8490c 100644 --- a/app/Models/Financeiro/Contas.php +++ b/app/Models/Financeiro/Contas.php @@ -9,10 +9,12 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Http\Request; +use OwenIt\Auditing\Contracts\Auditable; -class Contas extends Model +class Contas extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; protected $fillable = [ 'tipo', @@ -172,7 +174,7 @@ public static function RelatorioContasAbertas(Request $request): ?object $query->selectRaw(' contas.id, contas.tipo, - contas.name, + contas.name, contas.os_id, contas.venda_id, clientes.name as cliente, diff --git a/app/Models/Financeiro/MetaContabil.php b/app/Models/Financeiro/MetaContabil.php index 1634576e..b9d27552 100644 --- a/app/Models/Financeiro/MetaContabil.php +++ b/app/Models/Financeiro/MetaContabil.php @@ -7,9 +7,12 @@ use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Model; use Illuminate\Http\Request; +use OwenIt\Auditing\Contracts\Auditable; -class MetaContabil extends Model +class MetaContabil extends Model implements Auditable { + use \OwenIt\Auditing\Auditable; + /** * Relacionamento com o Centro de Custo. */ diff --git a/app/Models/Financeiro/Pagamentos.php b/app/Models/Financeiro/Pagamentos.php index 4d7a00ca..bfa6c02d 100644 --- a/app/Models/Financeiro/Pagamentos.php +++ b/app/Models/Financeiro/Pagamentos.php @@ -8,10 +8,12 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Http\Request; +use OwenIt\Auditing\Contracts\Auditable; -class Pagamentos extends Model +class Pagamentos extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; protected $table = 'contas_pagamentos'; diff --git a/app/Models/Os/Os.php b/app/Models/Os/Os.php index f6e131c5..3ab6e45e 100644 --- a/app/Models/Os/Os.php +++ b/app/Models/Os/Os.php @@ -16,10 +16,12 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Support\Facades\DB; +use OwenIt\Auditing\Contracts\Auditable; -class Os extends Model +class Os extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; protected $casts = [ 'data_entrada' => 'date', diff --git a/app/Models/Os/OsChecklist.php b/app/Models/Os/OsChecklist.php index 9bae9a3d..7d3b5d32 100644 --- a/app/Models/Os/OsChecklist.php +++ b/app/Models/Os/OsChecklist.php @@ -4,10 +4,12 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use OwenIt\Auditing\Contracts\Auditable; -class OsChecklist extends Model +class OsChecklist extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; protected $fillable = [ 'name', diff --git a/app/Models/Os/OsInformacao.php b/app/Models/Os/OsInformacao.php index 1b484648..e90c1bca 100644 --- a/app/Models/Os/OsInformacao.php +++ b/app/Models/Os/OsInformacao.php @@ -4,10 +4,12 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use OwenIt\Auditing\Contracts\Auditable; -class OsInformacao extends Model +class OsInformacao extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; protected $fillable = [ 'user_id', @@ -16,7 +18,7 @@ class OsInformacao extends Model 'tipo_informacao', 'informacao', 'status', - + 'usuario', ]; protected $casts = [ diff --git a/app/Models/Os/OsProduto.php b/app/Models/Os/OsProduto.php index 53b9922d..1786c226 100644 --- a/app/Models/Os/OsProduto.php +++ b/app/Models/Os/OsProduto.php @@ -7,10 +7,12 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use OwenIt\Auditing\Contracts\Auditable; -class OsProduto extends Model +class OsProduto extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; protected $fillable = [ 'valor_custo', diff --git a/app/Models/Os/OsServico.php b/app/Models/Os/OsServico.php index c3fa5a74..44b245da 100644 --- a/app/Models/Os/OsServico.php +++ b/app/Models/Os/OsServico.php @@ -6,10 +6,12 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use OwenIt\Auditing\Contracts\Auditable; -class OsServico extends Model +class OsServico extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; protected $fillable = [ 'servico_id', diff --git a/app/Models/OsLab/PaginaFavorita.php b/app/Models/OsLab/PaginaFavorita.php index df441329..14c138c9 100644 --- a/app/Models/OsLab/PaginaFavorita.php +++ b/app/Models/OsLab/PaginaFavorita.php @@ -8,4 +8,34 @@ class PaginaFavorita extends Model { use HasFactory; + + protected $table = 'pagina_favoritas'; + + protected $fillable = [ + 'user_id', + 'route', + 'text', + 'icon', + 'color', + 'order', + ]; + + protected $casts = [ + 'order' => 'integer', + ]; + + public const AVAILABLE_COLORS = [ + 'btn-primary' => 'Azul (Padrão)', + 'btn-secondary' => 'Cinza', + 'btn-success' => 'Verde', + 'btn-danger' => 'Vermelho', + 'btn-warning' => 'Amarelo', + 'btn-info' => 'Azul Claro', + 'btn-oslab' => 'OSLab', + ]; + + public function user() + { + return $this->belongsTo(\App\Models\User::class); + } } diff --git a/app/Models/Produto/Produto.php b/app/Models/Produto/Produto.php index 95a3bfb5..0608a4f8 100644 --- a/app/Models/Produto/Produto.php +++ b/app/Models/Produto/Produto.php @@ -10,10 +10,12 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Http\Request; +use OwenIt\Auditing\Contracts\Auditable; -class Produto extends Model +class Produto extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; /** * Retornar as movimentações dos Produtos. diff --git a/app/Models/Servico/Servico.php b/app/Models/Servico/Servico.php index e4dd0ad8..2bd09bce 100644 --- a/app/Models/Servico/Servico.php +++ b/app/Models/Servico/Servico.php @@ -7,10 +7,12 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; +use OwenIt\Auditing\Contracts\Auditable; -class Servico extends Model +class Servico extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; /** * Retornar as Os dos Produtos. diff --git a/app/Models/Venda/Venda.php b/app/Models/Venda/Venda.php index 1d206405..16f7b2bb 100644 --- a/app/Models/Venda/Venda.php +++ b/app/Models/Venda/Venda.php @@ -11,10 +11,12 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Support\Facades\DB; +use OwenIt\Auditing\Contracts\Auditable; -class Venda extends Model +class Venda extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; protected $casts = [ 'data_saida' => 'date', diff --git a/app/Models/Venda/VendaProduto.php b/app/Models/Venda/VendaProduto.php index 400bbb4a..bdc27580 100644 --- a/app/Models/Venda/VendaProduto.php +++ b/app/Models/Venda/VendaProduto.php @@ -6,10 +6,12 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use OwenIt\Auditing\Contracts\Auditable; -class VendaProduto extends Model +class VendaProduto extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; protected $fillable = [ 'valor_custo', diff --git a/app/Models/Wiki/File.php b/app/Models/Wiki/File.php index 10b3ae72..fa68e1ae 100644 --- a/app/Models/Wiki/File.php +++ b/app/Models/Wiki/File.php @@ -4,10 +4,12 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use OwenIt\Auditing\Contracts\Auditable; -class File extends Model +class File extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; protected $table = 'wiki_files'; diff --git a/app/Models/Wiki/Link.php b/app/Models/Wiki/Link.php index c98e3e7c..a953d48d 100644 --- a/app/Models/Wiki/Link.php +++ b/app/Models/Wiki/Link.php @@ -4,10 +4,12 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use OwenIt\Auditing\Contracts\Auditable; -class Link extends Model +class Link extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; protected $table = 'wiki_links'; diff --git a/app/Models/Wiki/Wiki.php b/app/Models/Wiki/Wiki.php index 37508748..3e533b7b 100644 --- a/app/Models/Wiki/Wiki.php +++ b/app/Models/Wiki/Wiki.php @@ -11,10 +11,12 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Http\Request; +use OwenIt\Auditing\Contracts\Auditable; -class Wiki extends Model +class Wiki extends Model implements Auditable { use HasFactory; + use \OwenIt\Auditing\Auditable; public function fabricante() { @@ -78,6 +80,7 @@ public static function getDataTable(Request $request, int $itensPorPagina = 100) if (isset($request->busca)) { $queryWiki->where(function ($query) use ($request) { $query->where('wikis.name', 'LIKE', '%'.$request->busca.'%'); + $query->orWhere('wikis.texto', 'LIKE', '%'.$request->busca.'%'); $query->orWhereHas('modelos', function ($query) use ($request) { $query->where('name', 'LIKE', '%'.$request->busca.'%'); }); @@ -91,7 +94,25 @@ public static function getDataTable(Request $request, int $itensPorPagina = 100) } $queryWiki->orderBy('fabricantes.name')->orderBy('wikis.name'); - return $queryWiki->paginate($itensPorPagina); + // Aqui a paginação é feita e armazenada + $wikiPaginada = $queryWiki->paginate($itensPorPagina); + + // Modifica apenas os itens da página atual + $wikiPaginada->getCollection()->transform(function ($ordem) use ($request) { + if (! $request->busca) { + return $ordem; + } + + foreach (['texto'] as $campo) { + if (! empty($ordem->$campo) && stripos($ordem->$campo, $request->busca) !== false) { + $ordem->{'snippet_'.$campo} = self::gerarSnippet($ordem->$campo, $request->busca, 200); + } + } + + return $ordem; + }); + + return $wikiPaginada; } public function modelosTitle() @@ -103,4 +124,38 @@ public function modelosTitle() return rtrim($return, ', '); } + + /** + * Gerar o Snippet com o texto ja tratado. + * + * @param string $texto Texto base para ser buscado + * @param string $busca Busca a ser realizada + * @param int $contexto Quantidade de letras antes e depois do retorno + * @return string retorna o texto pronto para ser exibido + * + **/ + protected static function gerarSnippet($texto, $busca, $contexto = 50) + { + $textoLimpo = strip_tags($texto); + $busca = trim($busca); + $pos = stripos($textoLimpo, $busca); + + if ($pos === false) { + return null; + } + + $inicio = max($pos - $contexto, 0); + $fim = min($pos + strlen($busca) + $contexto, strlen($textoLimpo)); + + $prefixo = ($inicio > 0) ? '... ' : ''; + $sufixo = ($fim < strlen($textoLimpo)) ? ' ...' : ''; + + $snippet = substr($textoLimpo, $inicio, $fim - $inicio); + + // Destaque do termo buscado + $pattern = '/'.preg_quote($busca, '/').'/i'; + $snippet = preg_replace($pattern, '$0', $snippet); + + return $prefixo.$snippet.$sufixo; + } } diff --git a/app/Policies/PaginaFavoritaPolicy.php b/app/Policies/PaginaFavoritaPolicy.php new file mode 100644 index 00000000..7a22c675 --- /dev/null +++ b/app/Policies/PaginaFavoritaPolicy.php @@ -0,0 +1,65 @@ +id === $paginaFavorita->user_id; + } + + /** + * Determine whether the user can create models. + */ + public function create(User $user): bool + { + return true; + } + + /** + * Determine whether the user can update the model. + */ + public function update(User $user, PaginaFavorita $paginaFavorita): bool + { + return $user->id === $paginaFavorita->user_id; + } + + /** + * Determine whether the user can delete the model. + */ + public function delete(User $user, PaginaFavorita $paginaFavorita): bool + { + return $user->id === $paginaFavorita->user_id; + } + + /** + * Determine whether the user can restore the model. + */ + public function restore(User $user, PaginaFavorita $paginaFavorita): bool + { + return $user->id === $paginaFavorita->user_id; + } + + /** + * Determine whether the user can permanently delete the model. + */ + public function forceDelete(User $user, PaginaFavorita $paginaFavorita): bool + { + return $user->id === $paginaFavorita->user_id; + } +} diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 54756cd1..08af54a3 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -3,6 +3,8 @@ namespace App\Providers; // use Illuminate\Support\Facades\Gate; +use App\Models\OsLab\PaginaFavorita; +use App\Policies\PaginaFavoritaPolicy; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; class AuthServiceProvider extends ServiceProvider @@ -13,7 +15,7 @@ class AuthServiceProvider extends ServiceProvider * @var array */ protected $policies = [ - // + PaginaFavorita::class => PaginaFavoritaPolicy::class, ]; /** diff --git a/app/Services/Os/OsService.php b/app/Services/Os/OsService.php index 48382e92..dbf9216d 100644 --- a/app/Services/Os/OsService.php +++ b/app/Services/Os/OsService.php @@ -33,7 +33,7 @@ public static function getDataTable(Request $request, int $itensPorPagina = 100, $dataHoje = Carbon::now()->format('Y-m-d'); $osListagemPadrao = getConfig('os_listagem_padrao'); - $queryOs = Os::with(['cliente', 'tecnico', 'categoria', 'status']); + $queryOs = Os::with(['cliente', 'tecnico', 'categoria', 'status', 'informacoes']); if ($request->busca) { $queryOs->where(function ($query) use ($request) { @@ -91,7 +91,7 @@ public static function getDataTable(Request $request, int $itensPorPagina = 100, foreach (['descricao', 'defeito', 'observacoes', 'laudo'] as $campo) { if (! empty($ordem->$campo) && stripos($ordem->$campo, $request->busca) !== false) { - $ordem->{'snippet_'.$campo} = self::gerarSnippet($ordem->$campo, $request->busca, 80); + $ordem->{'snippet_'.$campo} = self::gerarSnippet($ordem->$campo, $request->busca, 200); } } diff --git a/app/Services/OsLab/FavoriteMenuService.php b/app/Services/OsLab/FavoriteMenuService.php index 7217944c..d086345b 100644 --- a/app/Services/OsLab/FavoriteMenuService.php +++ b/app/Services/OsLab/FavoriteMenuService.php @@ -67,6 +67,8 @@ public function favoriteRoute($routeName) $paginaFavorita->route = $routeName; $paginaFavorita->icon = $icon; $paginaFavorita->text = $text; + $paginaFavorita->color = 'btn-primary'; + $paginaFavorita->order = PaginaFavorita::where('user_id', $userId)->max('order') + 1; $paginaFavorita->save(); } @@ -92,7 +94,7 @@ public function getUserFavoriteData() { $userId = Auth::id(); - return PaginaFavorita::where('user_id', $userId)->get(); + return PaginaFavorita::where('user_id', $userId)->orderBy('order')->get(); } /** diff --git a/app/Services/Venda/VendaService.php b/app/Services/Venda/VendaService.php index 2a827004..a9d67a57 100644 --- a/app/Services/Venda/VendaService.php +++ b/app/Services/Venda/VendaService.php @@ -34,7 +34,7 @@ public static function getDataTable(Request $request, int $itensPorPagina = 100, $dataHoje = Carbon::now()->format('Y-m-d'); $vendaListagemPadrao = getConfig('venda_listagem_padrao'); - $queryVenda = Venda::with(['cliente', 'vendedor']); + $queryVenda = Venda::with(['cliente', 'vendedor', 'status']); if ($request->busca) { $queryVenda->where(function ($query) use ($request) { diff --git a/composer.json b/composer.json index a284687a..c0c07587 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,7 @@ "laravellegends/pt-br-validator": "^12.0", "livewire/livewire": "^3.4", "opcodesio/log-viewer": "^3.15", + "owen-it/laravel-auditing": "^14.0", "php-flasher/flasher-laravel": "^2.1", "spatie/laravel-backup": "^9.3", "spatie/laravel-html": "^3.2", diff --git a/composer.lock b/composer.lock index e1c4b9e7..762ecf78 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5efba3922bd708193b1eb76e212ddc09", + "content-hash": "29e63f39c1e1243226548d2036c44e74", "packages": [ { "name": "almasaeed2010/adminlte", @@ -3957,6 +3957,90 @@ }, "time": "2023-11-19T08:47:43+00:00" }, + { + "name": "owen-it/laravel-auditing", + "version": "v14.0.3", + "source": { + "type": "git", + "url": "https://github.com/owen-it/laravel-auditing.git", + "reference": "34e8a21890082a7a353894a4acdeb2d301dbe0d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/owen-it/laravel-auditing/zipball/34e8a21890082a7a353894a4acdeb2d301dbe0d4", + "reference": "34e8a21890082a7a353894a4acdeb2d301dbe0d4", + "shasum": "" + }, + "require": { + "ext-json": "*", + "illuminate/console": "^11.0|^12.0|^13.0", + "illuminate/database": "^11.0|^12.0|^13.0", + "illuminate/filesystem": "^11.0|^12.0|^13.0", + "php": "^8.2" + }, + "require-dev": { + "mockery/mockery": "^1.5.1", + "orchestra/testbench": "^9.0|^10.0|^11.0", + "phpunit/phpunit": "^11.0|^12.5.12" + }, + "type": "package", + "extra": { + "laravel": { + "providers": [ + "OwenIt\\Auditing\\AuditingServiceProvider" + ] + }, + "branch-alias": { + "dev-master": "v14-dev" + } + }, + "autoload": { + "psr-4": { + "OwenIt\\Auditing\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Antério Vieira", + "email": "anteriovieira@gmail.com" + }, + { + "name": "Raphael França", + "email": "raphaelfrancabsb@gmail.com" + }, + { + "name": "Morten D. Hansen", + "email": "morten@visia.dk" + } + ], + "description": "Audit changes of your Eloquent models in Laravel", + "homepage": "https://laravel-auditing.com", + "keywords": [ + "Accountability", + "Audit", + "auditing", + "changes", + "eloquent", + "history", + "laravel", + "log", + "logging", + "lumen", + "observer", + "record", + "revision", + "tracking" + ], + "support": { + "issues": "https://github.com/owen-it/laravel-auditing/issues", + "source": "https://github.com/owen-it/laravel-auditing" + }, + "time": "2026-03-27T13:27:17+00:00" + }, { "name": "paragonie/constant_time_encoding", "version": "v3.0.0", @@ -12158,5 +12242,5 @@ "php": "^8.2" }, "platform-dev": {}, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.9.0" } diff --git a/config/adminlte.php b/config/adminlte.php index dd855761..4cb8a289 100644 --- a/config/adminlte.php +++ b/config/adminlte.php @@ -303,16 +303,16 @@ 'can' => 'config_perfil', 'topnav_user' => true, ], - // Navbar items: - [ - 'type' => 'navbar-search', - 'text' => 'Buscar', - 'topnav_right' => true, - 'url' => 'buscar', - 'method' => 'GET', - 'input_name' => 'busca', + // // Navbar items: + // [ + // 'type' => 'navbar-search', + // 'text' => 'Buscar', + // 'topnav_right' => true, + // 'url' => 'buscar', + // 'method' => 'GET', + // 'input_name' => 'busca', - ], + // ], // [ // 'text' => 'asd', // 'icon' => 'fa-regular fa-star', @@ -457,7 +457,7 @@ 'icon' => 'fa-regular fa-file-lines', 'can' => [ 'relatorio_financeiro_balancete', 'relatorio_financeiro_receita_despesa', 'relatorio_financeiro_conta_aberta', - 'relatorio_sistema_log', + 'relatorio_sistema_log', 'relatorio_sistema_auditoria', ], 'submenu' => [ [ @@ -495,6 +495,7 @@ 'icon' => 'fa-solid fa-sitemap', 'can' => [ 'relatorio_sistema_log', + 'relatorio_sistema_auditoria', ], 'submenu' => [ [ @@ -504,6 +505,13 @@ 'target' => '_blank', 'can' => 'relatorio_sistema_log', ], + [ + 'text' => 'Auditoria', + 'icon' => 'fas fa-history', + 'route' => 'relatorio.sistema.auditoria.index', + 'active' => ['relatorio/sistema/auditoria*'], + 'can' => 'relatorio_sistema_auditoria', + ], ], ], ], @@ -519,6 +527,7 @@ 'config_wiki_fabricante', 'config_wiki_modelo', 'config_sistema', 'config_emitente', + 'config_pagina_favorita', ], 'submenu' => [ @@ -645,6 +654,13 @@ 'active' => ['configuracoes/emitente*'], 'can' => 'config_emitente', ], + [ + 'text' => 'Páginas Favoritas', + 'icon' => 'fas fa-star', + 'route' => 'configuracao.pagina-favorita.index', + 'active' => ['configuracoes/pagina-favorita*'], + 'can' => 'config_pagina_favorita', + ], [ 'text' => 'Backup', 'icon' => 'fa-solid fa-server', diff --git a/config/app.php b/config/app.php index 327fb5e4..ef9fade5 100644 --- a/config/app.php +++ b/config/app.php @@ -176,6 +176,9 @@ // Image Intervention.io // Intervention\Image\ImageServiceProvider::class, + // Laravel Auditing + OwenIt\Auditing\AuditingServiceProvider::class, + ])->toArray(), /* diff --git a/config/audit.php b/config/audit.php new file mode 100644 index 00000000..9c94d549 --- /dev/null +++ b/config/audit.php @@ -0,0 +1,198 @@ + env('AUDITING_ENABLED', true), + + /* + |-------------------------------------------------------------------------- + | Audit Implementation + |-------------------------------------------------------------------------- + | + | Define which Audit model implementation should be used. + | + */ + + 'implementation' => OwenIt\Auditing\Models\Audit::class, + + /* + |-------------------------------------------------------------------------- + | User Morph prefix & Guards + |-------------------------------------------------------------------------- + | + | Define the morph prefix and authentication guards for the User resolver. + | + */ + + 'user' => [ + 'morph_prefix' => 'user', + 'guards' => [ + 'web', + 'api', + ], + 'resolver' => OwenIt\Auditing\Resolvers\UserResolver::class, + ], + + /* + |-------------------------------------------------------------------------- + | Audit Resolvers + |-------------------------------------------------------------------------- + | + | Define the IP Address, User Agent and URL resolver implementations. + | + */ + 'resolvers' => [ + 'ip_address' => OwenIt\Auditing\Resolvers\IpAddressResolver::class, + 'user_agent' => OwenIt\Auditing\Resolvers\UserAgentResolver::class, + 'url' => OwenIt\Auditing\Resolvers\UrlResolver::class, + ], + + /* + |-------------------------------------------------------------------------- + | Audit Events + |-------------------------------------------------------------------------- + | + | The Eloquent events that trigger an Audit. + | + */ + + 'events' => [ + 'created', + 'updated', + 'deleted', + 'restored', + ], + + /* + |-------------------------------------------------------------------------- + | Strict Mode + |-------------------------------------------------------------------------- + | + | Enable the strict mode when auditing? + | + */ + + 'strict' => false, + + /* + |-------------------------------------------------------------------------- + | Global exclude + |-------------------------------------------------------------------------- + | + | Have something you always want to exclude by default? - add it here. + | Note that this is overwritten (not merged) with local exclude + | + */ + + 'exclude' => [], + + /* + |-------------------------------------------------------------------------- + | Empty Values + |-------------------------------------------------------------------------- + | + | Should Audit records be stored when the recorded old_values & new_values + | are both empty? + | + | Some events may be empty on purpose. Use allowed_empty_values to exclude + | those from the empty values check. For example when auditing + | model retrieved events which will never have new and old values. + | + | + */ + + 'empty_values' => true, + 'allowed_empty_values' => [ + 'retrieved', + ], + + /* + |-------------------------------------------------------------------------- + | Allowed Array Values + |-------------------------------------------------------------------------- + | + | Should the array values be audited? + | + | By default, array values are not allowed. This is to prevent performance + | issues when storing large amounts of data. You can override this by + | setting allow_array_values to true. + */ + 'allowed_array_values' => false, + + /* + |-------------------------------------------------------------------------- + | Audit Timestamps + |-------------------------------------------------------------------------- + | + | Should the created_at, updated_at and deleted_at timestamps be audited? + | + */ + + 'timestamps' => false, + + /* + |-------------------------------------------------------------------------- + | Audit Threshold + |-------------------------------------------------------------------------- + | + | Specify a threshold for the amount of Audit records a model can have. + | Zero means no limit. + | + */ + + 'threshold' => 0, + + /* + |-------------------------------------------------------------------------- + | Audit Driver + |-------------------------------------------------------------------------- + | + | The default audit driver used to keep track of changes. + | + */ + + 'driver' => 'database', + + /* + |-------------------------------------------------------------------------- + | Audit Driver Configurations + |-------------------------------------------------------------------------- + | + | Available audit drivers and respective configurations. + | + */ + + 'drivers' => [ + 'database' => [ + 'table' => 'audits', + 'connection' => null, + ], + ], + + /* + |-------------------------------------------------------------------------- + | Audit Queue Configurations + |-------------------------------------------------------------------------- + | + | Available audit queue configurations. + | + */ + + 'queue' => [ + 'enable' => false, + 'connection' => 'sync', + 'queue' => 'default', + 'delay' => 0, + ], + + /* + |-------------------------------------------------------------------------- + | Audit Console + |-------------------------------------------------------------------------- + | + | Whether console events should be audited (eg. php artisan db:seed). + | + */ + + 'console' => false, +]; diff --git a/config/breadcrumbs.php b/config/breadcrumbs.php index 67fa04d9..5c91af24 100644 --- a/config/breadcrumbs.php +++ b/config/breadcrumbs.php @@ -49,13 +49,13 @@ */ // When route-bound breadcrumbs are used but the current route doesn't have a name (UnnamedRouteException) - 'unnamed-route-exception' => true, + 'unnamed-route-exception' => false, // When route-bound breadcrumbs are used and the matching breadcrumb doesn't exist (InvalidBreadcrumbException) - 'missing-route-bound-breadcrumb-exception' => true, + 'missing-route-bound-breadcrumb-exception' => false, // When a named breadcrumb is used but doesn't exist (InvalidBreadcrumbException) - 'invalid-named-breadcrumb-exception' => true, + 'invalid-named-breadcrumb-exception' => false, /* |-------------------------------------------------------------------------- diff --git a/config/database.php b/config/database.php index fdeafaf7..790da2ba 100644 --- a/config/database.php +++ b/config/database.php @@ -61,6 +61,10 @@ 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], + // Adicione este bloco no final do array da conexão: + 'dump' => [ + 'add_extra_option' => '--skip-ssl', + ], ], 'pgsql' => [ diff --git a/config/version.php b/config/version.php new file mode 100644 index 00000000..6769a7b6 --- /dev/null +++ b/config/version.php @@ -0,0 +1,49 @@ +/dev/null')); + if (! empty($gitBranch)) { + $branch = $gitBranch; + } + + // Pega o Hash completo para o link local funcionar + $gitFullHash = trim(@exec('git rev-parse HEAD 2>/dev/null')); + if (! empty($gitFullHash)) { + $fullHash = $gitFullHash; + } + } + + $appVersion = "{$baseVersion}-{$branch}"; + + // Substitua "bulfaitelo/OSLab" pelo nome real do seu repositório no GitHub + $repoPath = env('GITHUB_REPO', 'bulfaitelo/OSLab'); + if ($branch !== 'dev') { + $appVersionUrl = "https://github.com/{$repoPath}/commit/{$fullHash}"; + } else { + $appVersionUrl = "https://github.com/{$repoPath}/commits"; + } +} + +return [ + 'show' => env('SHOW_VERSION', true), + 'number' => $appVersion, + 'url' => $appVersionUrl, +]; diff --git a/database/factories/Configuracao/Sistema/EmitenteFactory.php b/database/factories/Configuracao/Sistema/EmitenteFactory.php new file mode 100644 index 00000000..8a342466 --- /dev/null +++ b/database/factories/Configuracao/Sistema/EmitenteFactory.php @@ -0,0 +1,60 @@ + + */ +class EmitenteFactory extends Factory +{ + /** + * The name of the factory's corresponding model. + * + * @var class-string<\App\Models\Configuracao\Sistema\Emitente> + */ + protected $model = Emitente::class; + + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + 'cnpj' => $this->faker->regexify('\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}'), + 'name' => $this->faker->company(), + 'fantasia' => $this->faker->word(), + 'porte' => $this->faker->randomElement(['MEI', 'Microempresa', 'Pequena Empresa', 'Média Empresa', 'Grande Empresa']), + 'inscricao_estadual' => $this->faker->regexify('\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}'), + 'cep' => $this->faker->postcode(), + 'logradouro' => $this->faker->streetName(), + 'numero' => $this->faker->buildingNumber(), + 'bairro' => $this->faker->word(), + 'cidade' => $this->faker->city(), + 'uf' => $this->faker->stateAbbr(), + 'telefone' => $this->faker->phoneNumber(), + 'site_url' => $this->faker->url(), + 'email' => $this->faker->unique()->companyEmail(), + 'complemento' => $this->faker->optional()->text(50), + 'logo_url' => null, + ]; + } + + /** + * Indica que o emitente é a empresa principal (ID = 1). + */ + public function principal(): static + { + return $this->state(function (array $attributes) { + return [ + 'id' => 1, + 'name' => 'Empresa Principal', + 'fantasia' => 'Empresa Principal LTDA', + ]; + }); + } +} diff --git a/database/migrations/2024_08_14_094153_create_pagina_favoritas_table.php b/database/migrations/2024_08_14_094153_create_pagina_favoritas_table.php index 2ae99194..17b57648 100644 --- a/database/migrations/2024_08_14_094153_create_pagina_favoritas_table.php +++ b/database/migrations/2024_08_14_094153_create_pagina_favoritas_table.php @@ -12,6 +12,7 @@ public function up(): void { Schema::create('pagina_favoritas', function (Blueprint $table) { + $table->id(); $table->unsignedBigInteger('user_id'); $table->string('route')->index(); $table->string('text')->nullable(); diff --git a/database/migrations/2024_08_14_094154_add_color_and_order_to_pagina_favoritas_table.php b/database/migrations/2024_08_14_094154_add_color_and_order_to_pagina_favoritas_table.php new file mode 100644 index 00000000..bd10a881 --- /dev/null +++ b/database/migrations/2024_08_14_094154_add_color_and_order_to_pagina_favoritas_table.php @@ -0,0 +1,29 @@ +string('color')->default('btn-primary')->after('icon'); + $table->unsignedInteger('order')->default(0)->after('color'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('pagina_favoritas', function (Blueprint $table) { + $table->dropColumn(['color', 'order']); + }); + } +}; diff --git a/database/migrations/2026_04_22_111959_update_os_informacaos_table.php b/database/migrations/2026_04_22_111959_update_os_informacaos_table.php new file mode 100644 index 00000000..26586058 --- /dev/null +++ b/database/migrations/2026_04_22_111959_update_os_informacaos_table.php @@ -0,0 +1,28 @@ +string('usuario')->nullable()->after('descricao')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('os_informacaos', function (Blueprint $table) { + $table->dropColumn('usuario'); + }); + } +}; diff --git a/database/migrations/2026_05_01_000000_update_categorias_add_text_fields.php b/database/migrations/2026_05_01_000000_update_categorias_add_text_fields.php new file mode 100644 index 00000000..db1172a7 --- /dev/null +++ b/database/migrations/2026_05_01_000000_update_categorias_add_text_fields.php @@ -0,0 +1,43 @@ +renameColumn('descricao', 'descricao_categoria'); + + // Adiciona os novos campos + $table->text('descricao')->nullable()->after('descricao_categoria'); + $table->text('defeito')->nullable()->after('descricao'); + $table->text('observacao')->nullable()->after('defeito'); + $table->text('laudo')->nullable()->after('observacao'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('categorias', function (Blueprint $table) { + // Remove os campos criados + $table->dropColumn([ + 'descricao', + 'defeito', + 'observacao', + 'laudo', + ]); + // Retorna o nome do campo para o original + $table->renameColumn('descricao_categoria', 'descricao'); + }); + } +}; diff --git a/database/migrations/2026_05_05_085235_create_audits_table.php b/database/migrations/2026_05_05_085235_create_audits_table.php new file mode 100644 index 00000000..f639a3e4 --- /dev/null +++ b/database/migrations/2026_05_05_085235_create_audits_table.php @@ -0,0 +1,47 @@ +create($table, function (Blueprint $table) { + $morphPrefix = config('audit.user.morph_prefix', 'user'); + + $table->bigIncrements('id'); + $table->string($morphPrefix.'_type')->nullable(); + $table->unsignedBigInteger($morphPrefix.'_id')->nullable(); + $table->string('event'); + $table->morphs('auditable'); + $table->text('old_values')->nullable(); + $table->text('new_values')->nullable(); + $table->text('url')->nullable(); + $table->ipAddress('ip_address')->nullable(); + $table->string('user_agent', 1023)->nullable(); + $table->string('tags')->nullable(); + $table->timestamps(); + + $table->index([$morphPrefix.'_id', $morphPrefix.'_type']); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + $connection = config('audit.drivers.database.connection', config('database.default')); + $table = config('audit.drivers.database.table', 'audits'); + + Schema::connection($connection)->drop($table); + } +}; diff --git a/database/migrations/2026_05_16_000001_add_id_to_pagina_favoritas_table.php b/database/migrations/2026_05_16_000001_add_id_to_pagina_favoritas_table.php new file mode 100644 index 00000000..d175cbcf --- /dev/null +++ b/database/migrations/2026_05_16_000001_add_id_to_pagina_favoritas_table.php @@ -0,0 +1,41 @@ +getDriverName(); + + if ($driver === 'mysql') { + DB::statement('ALTER TABLE pagina_favoritas ADD COLUMN id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST'); + } elseif ($driver === 'pgsql') { + DB::statement('ALTER TABLE pagina_favoritas ADD COLUMN id BIGSERIAL PRIMARY KEY'); + } else { + Schema::table('pagina_favoritas', function (Blueprint $table) { + $table->bigIncrements('id')->first(); + }); + } + } + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + if (Schema::hasColumn('pagina_favoritas', 'id')) { + Schema::table('pagina_favoritas', function (Blueprint $table) { + $table->dropColumn('id'); + }); + } + } +}; diff --git a/database/seeders/DefaultsConfigPermissionsRelatorio.php b/database/seeders/DefaultsConfigPermissionsRelatorio.php index 36c52075..5ed5f2f1 100644 --- a/database/seeders/DefaultsConfigPermissionsRelatorio.php +++ b/database/seeders/DefaultsConfigPermissionsRelatorio.php @@ -38,6 +38,12 @@ public function run(): void 'guard_name' => 'web', 'group_id' => 2, ], + [ + 'description' => 'Acesso ao Relatório de Auditoria do Sistema', + 'name' => 'relatorio_sistema_auditoria', + 'guard_name' => 'web', + 'group_id' => 2, + ], ]; foreach ($insert as $key => $value) { diff --git a/database/seeders/DefaultsConfigPermissionsSistema.php b/database/seeders/DefaultsConfigPermissionsSistema.php index a0fb37e2..cfd68bbf 100644 --- a/database/seeders/DefaultsConfigPermissionsSistema.php +++ b/database/seeders/DefaultsConfigPermissionsSistema.php @@ -26,6 +26,12 @@ public function run(): void 'guard_name' => 'web', 'group_id' => 11, ], + [ + 'description' => 'Acesso às páginas favoritas', + 'name' => 'config_pagina_favorita', + 'guard_name' => 'web', + 'group_id' => 11, + ], ]; diff --git a/database/seeders/EmitenteSeeder.php b/database/seeders/EmitenteSeeder.php new file mode 100644 index 00000000..7d81e550 --- /dev/null +++ b/database/seeders/EmitenteSeeder.php @@ -0,0 +1,18 @@ +principal()->create(); + } +} diff --git a/resources/views/checklist/create.blade.php b/resources/views/checklist/create.blade.php index bd9dc7ea..946d7e36 100644 --- a/resources/views/checklist/create.blade.php +++ b/resources/views/checklist/create.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/checklist/edit.blade.php b/resources/views/checklist/edit.blade.php index 056b093f..b2292253 100644 --- a/resources/views/checklist/edit.blade.php +++ b/resources/views/checklist/edit.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/checklist/index.blade.php b/resources/views/checklist/index.blade.php index 91ae5c16..98beff2c 100644 --- a/resources/views/checklist/index.blade.php +++ b/resources/views/checklist/index.blade.php @@ -11,9 +11,9 @@
- @can('checklist_create') diff --git a/resources/views/checklist/show.blade.php b/resources/views/checklist/show.blade.php index b22404b3..9d8a14b4 100644 --- a/resources/views/checklist/show.blade.php +++ b/resources/views/checklist/show.blade.php @@ -14,11 +14,19 @@
- + @can('relatorio_sistema_auditoria') + + + + @endcan
diff --git a/resources/views/cliente/create.blade.php b/resources/views/cliente/create.blade.php index 42fbfb2b..8d63a839 100644 --- a/resources/views/cliente/create.blade.php +++ b/resources/views/cliente/create.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/cliente/edit.blade.php b/resources/views/cliente/edit.blade.php index 55adce3d..accdd1de 100644 --- a/resources/views/cliente/edit.blade.php +++ b/resources/views/cliente/edit.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/cliente/index.blade.php b/resources/views/cliente/index.blade.php index 2fff60ba..b5c0a932 100644 --- a/resources/views/cliente/index.blade.php +++ b/resources/views/cliente/index.blade.php @@ -11,9 +11,9 @@
- @can('cliente_create') diff --git a/resources/views/configuracao/emitente/create.blade.php b/resources/views/configuracao/emitente/create.blade.php index 793c499c..2da38cf4 100644 --- a/resources/views/configuracao/emitente/create.blade.php +++ b/resources/views/configuracao/emitente/create.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/emitente/edit.blade.php b/resources/views/configuracao/emitente/edit.blade.php index dd1bc2c0..0aaf5b8e 100644 --- a/resources/views/configuracao/emitente/edit.blade.php +++ b/resources/views/configuracao/emitente/edit.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/financeiro/centro_custo/create.blade.php b/resources/views/configuracao/financeiro/centro_custo/create.blade.php index 38fe48f1..a28268f7 100644 --- a/resources/views/configuracao/financeiro/centro_custo/create.blade.php +++ b/resources/views/configuracao/financeiro/centro_custo/create.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/financeiro/centro_custo/edit.blade.php b/resources/views/configuracao/financeiro/centro_custo/edit.blade.php index 645a1833..32e90b3a 100644 --- a/resources/views/configuracao/financeiro/centro_custo/edit.blade.php +++ b/resources/views/configuracao/financeiro/centro_custo/edit.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/financeiro/centro_custo/index.blade.php b/resources/views/configuracao/financeiro/centro_custo/index.blade.php index 70d61e19..11e67e39 100644 --- a/resources/views/configuracao/financeiro/centro_custo/index.blade.php +++ b/resources/views/configuracao/financeiro/centro_custo/index.blade.php @@ -11,9 +11,9 @@
- @can('config_financeiro_centro_custo_create') diff --git a/resources/views/configuracao/financeiro/centro_custo/show.blade.php b/resources/views/configuracao/financeiro/centro_custo/show.blade.php index f7866fde..2569b19c 100644 --- a/resources/views/configuracao/financeiro/centro_custo/show.blade.php +++ b/resources/views/configuracao/financeiro/centro_custo/show.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/financeiro/forma_pagamento/create.blade.php b/resources/views/configuracao/financeiro/forma_pagamento/create.blade.php index ce53abcc..a4f6561c 100644 --- a/resources/views/configuracao/financeiro/forma_pagamento/create.blade.php +++ b/resources/views/configuracao/financeiro/forma_pagamento/create.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/financeiro/forma_pagamento/edit.blade.php b/resources/views/configuracao/financeiro/forma_pagamento/edit.blade.php index 8ab282ce..e6a39542 100644 --- a/resources/views/configuracao/financeiro/forma_pagamento/edit.blade.php +++ b/resources/views/configuracao/financeiro/forma_pagamento/edit.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/financeiro/forma_pagamento/index.blade.php b/resources/views/configuracao/financeiro/forma_pagamento/index.blade.php index a60c49f7..b2c891fd 100644 --- a/resources/views/configuracao/financeiro/forma_pagamento/index.blade.php +++ b/resources/views/configuracao/financeiro/forma_pagamento/index.blade.php @@ -11,9 +11,9 @@
- @can('config_financeiro_forma_pagamento_create') diff --git a/resources/views/configuracao/financeiro/forma_pagamento/show.blade.php b/resources/views/configuracao/financeiro/forma_pagamento/show.blade.php index 7bfaf9bd..2dcb1a97 100644 --- a/resources/views/configuracao/financeiro/forma_pagamento/show.blade.php +++ b/resources/views/configuracao/financeiro/forma_pagamento/show.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/garantia/create.blade.php b/resources/views/configuracao/garantia/create.blade.php index c0abe69c..259f81b6 100644 --- a/resources/views/configuracao/garantia/create.blade.php +++ b/resources/views/configuracao/garantia/create.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/garantia/edit.blade.php b/resources/views/configuracao/garantia/edit.blade.php index 718aed37..7121f8ec 100644 --- a/resources/views/configuracao/garantia/edit.blade.php +++ b/resources/views/configuracao/garantia/edit.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/garantia/index.blade.php b/resources/views/configuracao/garantia/index.blade.php index 4dd8b386..201ac616 100644 --- a/resources/views/configuracao/garantia/index.blade.php +++ b/resources/views/configuracao/garantia/index.blade.php @@ -11,9 +11,9 @@
- @can('config_garantia_create') diff --git a/resources/views/configuracao/garantia/show.blade.php b/resources/views/configuracao/garantia/show.blade.php index 86231981..26a68913 100644 --- a/resources/views/configuracao/garantia/show.blade.php +++ b/resources/views/configuracao/garantia/show.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/pagina-favorita/edit.blade.php b/resources/views/configuracao/pagina-favorita/edit.blade.php new file mode 100644 index 00000000..ae586410 --- /dev/null +++ b/resources/views/configuracao/pagina-favorita/edit.blade.php @@ -0,0 +1,114 @@ +@extends('adminlte::page') + +@section('title', 'Editar Página Favorita') + +@section('content_header') +
+
+

Editar Página Favorita

+
+
+ {!! html()->a(route('configuracao.pagina-favorita.index'), 'Voltar') + ->class('btn btn-sm btn-secondary') !!} +
+
+@stop + +@section('content') +
+
+
+
+

Informações da Página Favorita

+
+ + {!! html()->form('put', route('configuracao.pagina-favorita.update', ['pagina_favorita' => $favorita->id]))->open() !!} + @csrf +
+
+ + {!! html()->text('text', old('text', $favorita->text)) + ->class('form-control' . ($errors->has('text') ? ' is-invalid' : '')) + ->id('text') + ->required() !!} + @error('text') + {{ $message }} + @enderror +
+ +
+ + {!! html()->select('color', $colors, old('color', $favorita->color)) + ->class('form-control' . ($errors->has('color') ? ' is-invalid' : '')) + ->id('color') + ->required() !!} + @error('color') + {{ $message }} + @enderror +
+ +
+ +
+ {!! html()->button($favorita->text) + ->type('button') + ->id('preview-button') + ->class('btn ' . $favorita->color) !!} +
+
+ +
+ +
+ Rota: {{ $favorita->route }}
+ Ícone: {{ $favorita->icon }} +
+
+
+ + + {!! html()->form()->close() !!} +
+
+ +
+
+
+

Cores Disponíveis

+
+
+ @foreach ($colors as $colorClass => $colorLabel) +
+ {!! html()->button($colorLabel) + ->type('button') + ->class('btn btn-sm ' . $colorClass) !!} +
+ @endforeach +
+
+
+
+@stop + +@section('js') + +@stop diff --git a/resources/views/configuracao/pagina-favorita/index.blade.php b/resources/views/configuracao/pagina-favorita/index.blade.php new file mode 100644 index 00000000..e6d30ec1 --- /dev/null +++ b/resources/views/configuracao/pagina-favorita/index.blade.php @@ -0,0 +1,157 @@ +@extends('adminlte::page') + +@section('title', 'Gerenciar Páginas Favoritas') + +@section('content_header') +
+
+

Páginas Favoritas

+
+
+@stop + +@section('content') +
+
+
+
+

Gerencie suas páginas favoritas

+
+
+ @if ($favoritas->isEmpty()) +
+ Nenhuma página favorita cadastrada ainda. +
+ @else +
+ Dica: Você pode reorganizar as páginas favorites clicando e arrastando. + +
+ +
+ @foreach ($favoritas as $favorita) +
+
+
+ +
+
+ {{ $favorita->text }} +
+ Rota: {{ $favorita->route }} +
+
+
+ @can('config_pagina_favorita') +
+ + + + +
+ @endcan +
+ @endforeach +
+ @endif +
+
+
+
+ + + +@stop + +@section('css') + +@stop + +@section('js') + + +@stop diff --git a/resources/views/configuracao/parametro/categoria/create.blade.php b/resources/views/configuracao/parametro/categoria/create.blade.php index dbc4c15d..94b59f11 100644 --- a/resources/views/configuracao/parametro/categoria/create.blade.php +++ b/resources/views/configuracao/parametro/categoria/create.blade.php @@ -3,7 +3,7 @@ @section('title', 'Criar Categoria') @section('content_header') -

Criar Categoria

+

Criar Categoria

@stop @section('content') @@ -14,90 +14,136 @@
- - + + -
- @include('adminlte::partials.form-alert') - {!! html()->form('post', route('configuracao.parametro.categoria.store'))->open() !!} -
- - {!! html()->text('name')->class('form-control')->placeholder('Categoria')->required() !!} -
-
- - {!! html()->text('descricao')->class('form-control')->placeholder('Descrição') !!} -
-
-
-
- - {!! html()->select('garantia_id', \App\Models\Configuracao\Garantia\Garantia::where('os', 1)->orderBy('name')->pluck('name', 'id'))->class('form-control')->placeholder('Selecione') !!} -
+
+ @include('adminlte::partials.form-alert') + {!! html()->form('post', route('configuracao.parametro.categoria.store'))->open() !!} +
+ + {!! html()->text('name')->class('form-control')->placeholder('Categoria')->required() !!} +
+
+ + {!! html()->text('descricao_categoria')->class('form-control')->placeholder('Descrição') !!}
-
-
- - {!! html()->select('centro_custo_id', \App\Models\Configuracao\Financeiro\CentroCusto::orderBy('name')->where('receita', '1')->pluck('name', 'id'))->class('form-control')->placeholder('Selecione o Centro de Custo') !!} +
+
+
+ + {!! html()->select('garantia_id', \App\Models\Configuracao\Garantia\Garantia::where('os', 1)->orderBy('name')->pluck('name', 'id'))->class('form-control')->placeholder('Selecione') !!} +
+
+
+
+ + {!! html()->select('centro_custo_id', \App\Models\Configuracao\Financeiro\CentroCusto::orderBy('name')->where('receita', '1')->pluck('name', 'id'))->class('form-control')->placeholder('Selecione o Centro de Custo')->required() !!} +
-
-
-
-
- - {!! html()->select('checklist_id', \App\Models\Checklist\Checklist::orderBy('name')->pluck('name', 'id'))->class('form-control')->placeholder('Selecione') !!} +
+
+
+ + {!! html()->select('checklist_id', \App\Models\Checklist\Checklist::orderBy('name')->pluck('name', 'id'))->class('form-control')->placeholder('Selecione') !!} +
+
+
+
+ +
+ + +
+
-
-
- -
- - +
+

Informações padrão para preenchimento de OS

+
Essas informações serão utilizadas como padrão para preenchimento das OSs desta categoria
+
+
+
+ + {!! html()->textarea('descricao')->class('texto')->placeholder('Descrição padrão para esta categoria') !!} +
+
+
+
+ + {!! html()->textarea('defeito')->class('texto')->placeholder('Defeito padrão para esta categoria') !!} +
+
+
+
+
+
+ + {!! html()->textarea('observacao')->class('texto')->placeholder('Observação padrão para esta categoria') !!} +
+
+
+
+ + {!! html()->textarea('laudo')->class('texto')->placeholder('Laudo padrão para esta categoria') !!} +
-
- {{-- Minimal with icon only --}} - - + {{-- Minimal with icon only --}} + +
- - {!! html()->form()->close() !!} -
+ + {!! html()->form()->close() !!} +
@stop @section('css') + @stop @section('js') + + @stop diff --git a/resources/views/configuracao/parametro/categoria/edit.blade.php b/resources/views/configuracao/parametro/categoria/edit.blade.php index 1aefeac2..856d3ab1 100644 --- a/resources/views/configuracao/parametro/categoria/edit.blade.php +++ b/resources/views/configuracao/parametro/categoria/edit.blade.php @@ -3,7 +3,7 @@ @section('title', 'Editar Categoria') @section('content_header') -

Editar Categoria

+

Editar Categoria

@stop @section('content') @@ -14,90 +14,135 @@
- - + + -
- @include('adminlte::partials.form-alert') - {!! html()->form('put', route('configuracao.parametro.categoria.update', $categoria->id))->open() !!} -
- - {!! html()->text('name', $categoria->name)->class('form-control')->placeholder('Categoria')->required() !!} -
-
- - {!! html()->text('descricao', $categoria->descricao)->class('form-control')->placeholder('Descrição') !!} -
-
-
-
- - {!! html()->select('garantia_id', \App\Models\Configuracao\Garantia\Garantia::where('os', 1)->orderBy('name')->pluck('name', 'id'), $categoria->garantia_id)->class('form-control')->placeholder('Selecione') !!} -
+
+ @include('adminlte::partials.form-alert') + {!! html()->form('put', route('configuracao.parametro.categoria.update', $categoria->id))->open() !!} +
+ + {!! html()->text('name', $categoria->name)->class('form-control')->placeholder('Categoria')->required() !!} +
+
+ + {!! html()->text('descricao_categoria', $categoria->descricao_categoria)->class('form-control')->placeholder('Descrição') !!}
-
-
- - {!! html()->select('centro_custo_id', \App\Models\Configuracao\Financeiro\CentroCusto::orderBy('name')->where('receita', '1')->pluck('name', 'id'), $categoria->centro_custo_id)->class('form-control')->placeholder('Selecione o Centro de Custo')->required() !!} +
+
+
+ + {!! html()->select('garantia_id', \App\Models\Configuracao\Garantia\Garantia::where('os', 1)->orderBy('name')->pluck('name', 'id'), $categoria->garantia_id)->class('form-control')->placeholder('Selecione') !!} +
+
+
+
+ + {!! html()->select('centro_custo_id', \App\Models\Configuracao\Financeiro\CentroCusto::orderBy('name')->where('receita', '1')->pluck('name', 'id'), $categoria->centro_custo_id)->class('form-control')->placeholder('Selecione o Centro de Custo')->required() !!} +
-
-
-
-
- - {!! html()->select('checklist_id', \App\Models\Checklist\Checklist::orderBy('name')->pluck('name', 'id'), $categoria->checklist_id)->class('form-control')->placeholder('Selecione') !!} +
+
+
+ + {!! html()->select('checklist_id', \App\Models\Checklist\Checklist::orderBy('name')->pluck('name', 'id'), $categoria->checklist_id)->class('form-control')->placeholder('Selecione') !!} +
+
+
+
+ +
+ checklist_required)) value="1" id="checklist_required" + class="custom-control-input" onclick="alternaPagoAvista()"> + +
+
-
-
- -
- checklist_required)) value="1" id="checklist_required" class="custom-control-input" onclick="alternaPagoAvista()"> - +
+

Informações padrão para o preenchimento de OS

+
Essas informações serão utilizadas como padrão para preenchimento das OSs desta categoria
+
+
+
+ + {!! html()->textarea('descricao', $categoria->descricao)->class('texto')->placeholder('Descrição padrão para esta categoria') !!} +
+
+
+
+ + {!! html()->textarea('defeito', $categoria->defeito)->class('texto')->placeholder('Defeito padrão para esta categoria') !!} +
+
+
+
+
+
+ + {!! html()->textarea('observacao', $categoria->observacao)->class('texto')->placeholder('Observação padrão para esta categoria') !!} +
+
+
+
+ + {!! html()->textarea('laudo', $categoria->laudo)->class('texto')->placeholder('Laudo padrão para esta categoria') !!} +
-
- {{-- Minimal with icon only --}} - - + {{-- Minimal with icon only --}} + +
- - {!! html()->form()->close() !!} -
+ + {!! html()->form()->close() !!} +
@stop @section('css') + @stop @section('js') + + @stop diff --git a/resources/views/configuracao/parametro/categoria/index.blade.php b/resources/views/configuracao/parametro/categoria/index.blade.php index 251fcf2b..355d4184 100644 --- a/resources/views/configuracao/parametro/categoria/index.blade.php +++ b/resources/views/configuracao/parametro/categoria/index.blade.php @@ -18,9 +18,9 @@
- @can('config_categoria_create') diff --git a/resources/views/configuracao/parametro/categoria/show.blade.php b/resources/views/configuracao/parametro/categoria/show.blade.php index f354597e..0ae52ed8 100644 --- a/resources/views/configuracao/parametro/categoria/show.blade.php +++ b/resources/views/configuracao/parametro/categoria/show.blade.php @@ -3,7 +3,7 @@ @section('title', 'Visualizar Categoria') @section('content_header') -

Visualizar Categoria

+

Visualizar Categoria

@stop @section('content') @@ -14,76 +14,106 @@
- - + + -
-
- - {!! html()->text('name', $categoria->name)->class('form-control')->placeholder('Categoria')->disabled() !!} -
-
- - {!! html()->text('descricao', $categoria->descricao)->class('form-control')->placeholder('Descrição')->disabled() !!} -
-
-
-
- - {!! html()->select('garantia_id', \App\Models\Configuracao\Garantia\Garantia::orderBy('name')->pluck('name', 'id'), $categoria->garantia_id)->class('form-control')->placeholder('Selecione')->disabled() !!} -
+
+
+ + {!! html()->text('name', $categoria->name)->class('form-control')->placeholder('Categoria')->disabled() !!}
-
-
- - {!! html()->select('centro_custo_id', \App\Models\Configuracao\Financeiro\CentroCusto::orderBy('name')->where('receita', '1')->pluck('name', 'id'), $categoria->centro_custo_id)->class('form-control')->placeholder('Selecione o Centro de Custo')->required()->disabled() !!} +
+ + {!! html()->text('descricao_categoria', $categoria->descricao_categoria)->class('form-control')->placeholder('Descrição')->disabled() !!} +
+
+
+
+ + {!! html()->select('garantia_id', \App\Models\Configuracao\Garantia\Garantia::orderBy('name')->pluck('name', 'id'), $categoria->garantia_id)->class('form-control')->placeholder('Selecione')->disabled() !!} +
+
+
+
+ + {!! html()->select('centro_custo_id', \App\Models\Configuracao\Financeiro\CentroCusto::orderBy('name')->where('receita', '1')->pluck('name', 'id'), $categoria->centro_custo_id)->class('form-control')->placeholder('Selecione o Centro de Custo')->required()->disabled() !!} +
-
-
-
-
- - {!! html()->select('checklist_id', \App\Models\Checklist\Checklist::orderBy('name')->pluck('name', 'id'), $categoria->checklist_id)->class('form-control')->placeholder('Selecione')->disabled() !!} +
+
+
+ + {!! html()->select('checklist_id', \App\Models\Checklist\Checklist::orderBy('name')->pluck('name', 'id'), $categoria->checklist_id)->class('form-control')->placeholder('Selecione')->disabled() !!} +
+
+
+
+ +
+ checklist_required)) value="1" id="checklist_required" + class="custom-control-input" @disabled(true)> + +
+
-
-
- -
- checklist_required)) value="1" id="checklist_required" class="custom-control-input" @disabled(true)> - +
+

Informações padrão para o preenchimento de OS

+
Essas informações serão utilizadas como padrão para preenchimento das OSs desta categoria
+
+
+
+ + {!! html()->textarea('descricao', $categoria->descricao)->class('texto')->placeholder('Descrição padrão para esta categoria')->disabled() !!} +
+
+
+
+ + {!! html()->textarea('defeito', $categoria->defeito)->class('texto')->placeholder('Defeito padrão para esta categoria')->disabled() !!} +
+
+
+
+
+
+ + {!! html()->textarea('observacao', $categoria->observacao)->class('texto')->placeholder('Observação padrão para esta categoria')->disabled() !!} +
+
+
+
+ + {!! html()->textarea('laudo', $categoria->laudo)->class('texto')->placeholder('Laudo padrão para esta categoria')->disabled() !!} +
-
- {{-- Minimal with icon only --}} - + {{-- Minimal with icon only --}} +
- + -
+
@stop @section('css') + @stop @section('js') @@ -92,4 +122,24 @@ class="data_info fas fa-exclamation-circle" trigger: 'hover' }); + + + @stop diff --git a/resources/views/configuracao/parametro/status/create.blade.php b/resources/views/configuracao/parametro/status/create.blade.php index 1a8e172f..4ac123c2 100644 --- a/resources/views/configuracao/parametro/status/create.blade.php +++ b/resources/views/configuracao/parametro/status/create.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/parametro/status/edit.blade.php b/resources/views/configuracao/parametro/status/edit.blade.php index 59333736..9999f1cd 100644 --- a/resources/views/configuracao/parametro/status/edit.blade.php +++ b/resources/views/configuracao/parametro/status/edit.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/parametro/status/index.blade.php b/resources/views/configuracao/parametro/status/index.blade.php index 94cc8713..4e5e7fbf 100644 --- a/resources/views/configuracao/parametro/status/index.blade.php +++ b/resources/views/configuracao/parametro/status/index.blade.php @@ -18,9 +18,9 @@
- @can('config_status_create') diff --git a/resources/views/configuracao/parametro/status/show.blade.php b/resources/views/configuracao/parametro/status/show.blade.php index 42ae016e..151a0a50 100644 --- a/resources/views/configuracao/parametro/status/show.blade.php +++ b/resources/views/configuracao/parametro/status/show.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/users/create.blade.php b/resources/views/configuracao/users/create.blade.php index 14a9bbd6..2355f66f 100644 --- a/resources/views/configuracao/users/create.blade.php +++ b/resources/views/configuracao/users/create.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/users/edit.blade.php b/resources/views/configuracao/users/edit.blade.php index c693bc22..3e86fbd9 100644 --- a/resources/views/configuracao/users/edit.blade.php +++ b/resources/views/configuracao/users/edit.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/users/index.blade.php b/resources/views/configuracao/users/index.blade.php index 96e16360..eb2a539b 100644 --- a/resources/views/configuracao/users/index.blade.php +++ b/resources/views/configuracao/users/index.blade.php @@ -11,10 +11,10 @@
- - @can('config_users_create') diff --git a/resources/views/configuracao/users/permissions.blade.php b/resources/views/configuracao/users/permissions.blade.php index 17309373..b63e7c2b 100644 --- a/resources/views/configuracao/users/permissions.blade.php +++ b/resources/views/configuracao/users/permissions.blade.php @@ -15,9 +15,9 @@
diff --git a/resources/views/configuracao/users/roles/assign.blade.php b/resources/views/configuracao/users/roles/assign.blade.php index 4f518aa0..b2ed2e4b 100644 --- a/resources/views/configuracao/users/roles/assign.blade.php +++ b/resources/views/configuracao/users/roles/assign.blade.php @@ -12,9 +12,9 @@
diff --git a/resources/views/configuracao/users/roles/create.blade.php b/resources/views/configuracao/users/roles/create.blade.php index ff8f3978..716252f5 100644 --- a/resources/views/configuracao/users/roles/create.blade.php +++ b/resources/views/configuracao/users/roles/create.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/users/roles/edit.blade.php b/resources/views/configuracao/users/roles/edit.blade.php index ce69fdfd..0fda4673 100644 --- a/resources/views/configuracao/users/roles/edit.blade.php +++ b/resources/views/configuracao/users/roles/edit.blade.php @@ -15,9 +15,9 @@
diff --git a/resources/views/configuracao/users/roles/index.blade.php b/resources/views/configuracao/users/roles/index.blade.php index da3c7fab..eb810fd0 100644 --- a/resources/views/configuracao/users/roles/index.blade.php +++ b/resources/views/configuracao/users/roles/index.blade.php @@ -11,9 +11,9 @@
- @can('config_roles_create') diff --git a/resources/views/configuracao/users/roles/permissions/create.blade.php b/resources/views/configuracao/users/roles/permissions/create.blade.php index 5f521525..282060a9 100644 --- a/resources/views/configuracao/users/roles/permissions/create.blade.php +++ b/resources/views/configuracao/users/roles/permissions/create.blade.php @@ -13,10 +13,10 @@
diff --git a/resources/views/configuracao/users/roles/permissions/edit.blade.php b/resources/views/configuracao/users/roles/permissions/edit.blade.php index c7cbbdc2..87595bab 100644 --- a/resources/views/configuracao/users/roles/permissions/edit.blade.php +++ b/resources/views/configuracao/users/roles/permissions/edit.blade.php @@ -13,10 +13,10 @@
diff --git a/resources/views/configuracao/users/roles/permissions/index.blade.php b/resources/views/configuracao/users/roles/permissions/index.blade.php index 248b2022..87c0505b 100644 --- a/resources/views/configuracao/users/roles/permissions/index.blade.php +++ b/resources/views/configuracao/users/roles/permissions/index.blade.php @@ -10,10 +10,10 @@
- - @can('config_permissions_create') diff --git a/resources/views/configuracao/users/roles/show.blade.php b/resources/views/configuracao/users/roles/show.blade.php index 3fadebb9..ad92de11 100644 --- a/resources/views/configuracao/users/roles/show.blade.php +++ b/resources/views/configuracao/users/roles/show.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/users/setores/create.blade.php b/resources/views/configuracao/users/setores/create.blade.php index 11a508e8..45f5e907 100644 --- a/resources/views/configuracao/users/setores/create.blade.php +++ b/resources/views/configuracao/users/setores/create.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/users/setores/edit.blade.php b/resources/views/configuracao/users/setores/edit.blade.php index c22358c0..0398e981 100644 --- a/resources/views/configuracao/users/setores/edit.blade.php +++ b/resources/views/configuracao/users/setores/edit.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/users/setores/index.blade.php b/resources/views/configuracao/users/setores/index.blade.php index 91390a6c..8d929487 100644 --- a/resources/views/configuracao/users/setores/index.blade.php +++ b/resources/views/configuracao/users/setores/index.blade.php @@ -11,9 +11,9 @@
- @can('config_user_setor_create') diff --git a/resources/views/configuracao/users/show.blade.php b/resources/views/configuracao/users/show.blade.php index 972a69ce..cc2aaa2e 100644 --- a/resources/views/configuracao/users/show.blade.php +++ b/resources/views/configuracao/users/show.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/wiki/fabricante/create.blade.php b/resources/views/configuracao/wiki/fabricante/create.blade.php index 0b256ed3..49d91e6f 100644 --- a/resources/views/configuracao/wiki/fabricante/create.blade.php +++ b/resources/views/configuracao/wiki/fabricante/create.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/wiki/fabricante/edit.blade.php b/resources/views/configuracao/wiki/fabricante/edit.blade.php index 5150af1b..73a07da3 100644 --- a/resources/views/configuracao/wiki/fabricante/edit.blade.php +++ b/resources/views/configuracao/wiki/fabricante/edit.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/wiki/fabricante/index.blade.php b/resources/views/configuracao/wiki/fabricante/index.blade.php index e19845b8..a5370274 100644 --- a/resources/views/configuracao/wiki/fabricante/index.blade.php +++ b/resources/views/configuracao/wiki/fabricante/index.blade.php @@ -11,9 +11,9 @@
- @can('config_wiki_fabricante_create') diff --git a/resources/views/configuracao/wiki/fabricante/show.blade.php b/resources/views/configuracao/wiki/fabricante/show.blade.php index d098d29f..a513f5e8 100644 --- a/resources/views/configuracao/wiki/fabricante/show.blade.php +++ b/resources/views/configuracao/wiki/fabricante/show.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/wiki/modelo/create.blade.php b/resources/views/configuracao/wiki/modelo/create.blade.php index 37fe0437..9a05a3e9 100644 --- a/resources/views/configuracao/wiki/modelo/create.blade.php +++ b/resources/views/configuracao/wiki/modelo/create.blade.php @@ -13,9 +13,9 @@
diff --git a/resources/views/configuracao/wiki/modelo/edit.blade.php b/resources/views/configuracao/wiki/modelo/edit.blade.php index 4c6db96e..78835b5b 100644 --- a/resources/views/configuracao/wiki/modelo/edit.blade.php +++ b/resources/views/configuracao/wiki/modelo/edit.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/configuracao/wiki/modelo/index.blade.php b/resources/views/configuracao/wiki/modelo/index.blade.php index 420e352f..b2124412 100644 --- a/resources/views/configuracao/wiki/modelo/index.blade.php +++ b/resources/views/configuracao/wiki/modelo/index.blade.php @@ -11,9 +11,9 @@
- @can('config_wiki_modelo_create') diff --git a/resources/views/configuracao/wiki/modelo/show.blade.php b/resources/views/configuracao/wiki/modelo/show.blade.php index 22cca87a..31d48f68 100644 --- a/resources/views/configuracao/wiki/modelo/show.blade.php +++ b/resources/views/configuracao/wiki/modelo/show.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/financeiro/despesa/create.blade.php b/resources/views/financeiro/despesa/create.blade.php index ced39feb..285f9321 100644 --- a/resources/views/financeiro/despesa/create.blade.php +++ b/resources/views/financeiro/despesa/create.blade.php @@ -14,9 +14,9 @@
- @isset($os->id) diff --git a/resources/views/financeiro/despesa/edit.blade.php b/resources/views/financeiro/despesa/edit.blade.php index 6f715b6a..918cf0f3 100644 --- a/resources/views/financeiro/despesa/edit.blade.php +++ b/resources/views/financeiro/despesa/edit.blade.php @@ -14,9 +14,9 @@
- @can('financeiro_despesa_show') diff --git a/resources/views/financeiro/despesa/index.blade.php b/resources/views/financeiro/despesa/index.blade.php index 121a9a87..a50ad85a 100644 --- a/resources/views/financeiro/despesa/index.blade.php +++ b/resources/views/financeiro/despesa/index.blade.php @@ -11,9 +11,9 @@
- @can('financeiro_despesa_create') diff --git a/resources/views/financeiro/despesa/show.blade.php b/resources/views/financeiro/despesa/show.blade.php index 2c79c49d..e1173608 100644 --- a/resources/views/financeiro/despesa/show.blade.php +++ b/resources/views/financeiro/despesa/show.blade.php @@ -14,11 +14,19 @@
diff --git a/resources/views/financeiro/meta_contabil/edit.blade.php b/resources/views/financeiro/meta_contabil/edit.blade.php index 45b06495..0cadbc86 100644 --- a/resources/views/financeiro/meta_contabil/edit.blade.php +++ b/resources/views/financeiro/meta_contabil/edit.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/financeiro/meta_contabil/index.blade.php b/resources/views/financeiro/meta_contabil/index.blade.php index 0938b9e3..aad4e4fb 100644 --- a/resources/views/financeiro/meta_contabil/index.blade.php +++ b/resources/views/financeiro/meta_contabil/index.blade.php @@ -11,9 +11,9 @@
- @can('financeiro_meta_contabil_create') diff --git a/resources/views/financeiro/meta_contabil/show.blade.php b/resources/views/financeiro/meta_contabil/show.blade.php index 5b116ca3..9f1f057c 100644 --- a/resources/views/financeiro/meta_contabil/show.blade.php +++ b/resources/views/financeiro/meta_contabil/show.blade.php @@ -14,11 +14,19 @@
- + @can('relatorio_sistema_auditoria') + + + + @endcan
diff --git a/resources/views/financeiro/receita/create.blade.php b/resources/views/financeiro/receita/create.blade.php index 9d2d382c..6cd4dd59 100644 --- a/resources/views/financeiro/receita/create.blade.php +++ b/resources/views/financeiro/receita/create.blade.php @@ -14,9 +14,9 @@
diff --git a/resources/views/financeiro/receita/edit.blade.php b/resources/views/financeiro/receita/edit.blade.php index 95fc10a4..0c4a581b 100644 --- a/resources/views/financeiro/receita/edit.blade.php +++ b/resources/views/financeiro/receita/edit.blade.php @@ -14,9 +14,9 @@
- @can('financeiro_receita_show') diff --git a/resources/views/financeiro/receita/index.blade.php b/resources/views/financeiro/receita/index.blade.php index 7a66d78d..4021f37e 100644 --- a/resources/views/financeiro/receita/index.blade.php +++ b/resources/views/financeiro/receita/index.blade.php @@ -11,9 +11,9 @@
- @can('financeiro_receita_create') diff --git a/resources/views/financeiro/receita/show.blade.php b/resources/views/financeiro/receita/show.blade.php index 52a05ba2..b7071276 100644 --- a/resources/views/financeiro/receita/show.blade.php +++ b/resources/views/financeiro/receita/show.blade.php @@ -14,11 +14,19 @@
- + @can('relatorio_sistema_auditoria') + + + + @endcan @can('financeiro_receita_edit')
diff --git a/resources/views/livewire/cliente/show-cliente.blade.php b/resources/views/livewire/cliente/show-cliente.blade.php index 8501031d..9545177b 100644 --- a/resources/views/livewire/cliente/show-cliente.blade.php +++ b/resources/views/livewire/cliente/show-cliente.blade.php @@ -1,12 +1,18 @@
- - + @can('relatorio_sistema_auditoria') + + + Auditoria + + @endcan
diff --git a/resources/views/livewire/financeiro/add-pagamento-modal.blade.php b/resources/views/livewire/financeiro/add-pagamento-modal.blade.php index ddc1d947..d8d4011e 100644 --- a/resources/views/livewire/financeiro/add-pagamento-modal.blade.php +++ b/resources/views/livewire/financeiro/add-pagamento-modal.blade.php @@ -68,9 +68,9 @@ @forelse ($pagamentos as $pagamento) - {{ $pagamento->data_pagamento->format('d/m/Y') }} - {{ $pagamento->formaPagamento->name }} - R$ {{ number_format($pagamento->valor, 2, ',', '.') }} + {{ $pagamento->data_pagamento?->format('d/m/Y') ?? 'Pendente' }} + {{ $pagamento->formaPagamento?->name ?? 'Não definida' }} + R$ {{ number_format($pagamento->valor ?? 0, 2, ',', '.') }} @empty diff --git a/resources/views/livewire/home/dashboard/balancete-card.blade.php b/resources/views/livewire/home/dashboard/balancete-card.blade.php index 3715d942..be35f738 100644 --- a/resources/views/livewire/home/dashboard/balancete-card.blade.php +++ b/resources/views/livewire/home/dashboard/balancete-card.blade.php @@ -1,44 +1,80 @@ -
+@php + $formatarResumido = function($valor) { + $valor = $valor ?? 0; + if (abs($valor) >= 1000000) return number_format($valor / 1000000, 1, ',', '.') . 'M'; + if (abs($valor) >= 1000) return number_format($valor / 1000, 1, ',', '.') . 'k'; + return number_format($valor, 2, ',', '.'); + }; + + $formatarCompleto = function($valor) { + return number_format($valor ?? 0, 2, ',', '.'); + }; +@endphp + +{{-- Elemento RAIZ único exigido pelo Livewire --}} +
- {!! html()->select('mes', $meses, $mes_busca)->class('form-control')->attribute('wire:model.live', 'mes_busca') !!} -
-
- Receita -
-
- R$ {{ (isset($balancete->receita)) ? number_format($balancete->receita, 2, ',', '.') : '0,00' }} -
+ {!! html()->select('mes', $meses, $mes_busca)->class('form-control mb-3')->attribute('wire:model.live', 'mes_busca') !!} + +
+ + Receita + R + + + R$ {{ $formatarCompleto($balancete?->receita) }} + R$ {{ $formatarResumido($balancete?->receita) }} +
-
-
- Despesa -
-
- R$ {{ (isset($balancete->despesa)) ? number_format($balancete->despesa, 2, ',', '.') : '0,00' }} -
+ +
+ + Despesa + D + + + R$ {{ $formatarCompleto($balancete?->despesa) }} + R$ {{ $formatarResumido($balancete?->despesa) }} +
-
-
-
- (isset($balancete->saldo) && $balancete->saldo < 0) ? true : false, - 'balancete-credito' => (isset($balancete->saldo) && $balancete->saldo > 0) ? true : false, - ]) - >Saldo -
-
- (isset($balancete->saldo) && $balancete->saldo < 0) ? true : false, - 'balancete-credito' => (isset($balancete->saldo) && $balancete->saldo > 0) ? true : false, - ]) - >R$ {{ (isset($balancete->saldo)) ? number_format($balancete->saldo, 2, ',', '.') : '0,00' }} -
+ +
+ +
+ ($balancete?->saldo ?? 0) < 0, + 'balancete-credito' => ($balancete?->saldo ?? 0) >= 0, + ]) title="Saldo"> + Saldo + S + + + ($balancete?->saldo ?? 0) < 0, + 'balancete-credito' => ($balancete?->saldo ?? 0) >= 0, + ])> + R$ {{ $formatarCompleto($balancete?->saldo) }} + R$ {{ $formatarResumido($balancete?->saldo) }} +
+ @once + + @endonce
+ diff --git a/resources/views/livewire/home/dashboard/estatisticas-do-sistema-card.blade.php b/resources/views/livewire/home/dashboard/estatisticas-do-sistema-card.blade.php index 284d1fa5..059b506e 100644 --- a/resources/views/livewire/home/dashboard/estatisticas-do-sistema-card.blade.php +++ b/resources/views/livewire/home/dashboard/estatisticas-do-sistema-card.blade.php @@ -30,7 +30,7 @@ Clientes
- +
@can('cliente_create') @@ -48,7 +48,7 @@ Produtos
- +
@can('produto_create')
@@ -64,7 +64,7 @@ Serviços
- +
@can('servico_create')
@@ -82,7 +82,7 @@ Wiki
- +
@can('wiki_create')
@@ -98,7 +98,7 @@ Checklists
- +
@can('checklist_create')
diff --git a/resources/views/livewire/home/show-user-favorites.blade.php b/resources/views/livewire/home/show-user-favorites.blade.php index cc9dbd6d..16815646 100644 --- a/resources/views/livewire/home/show-user-favorites.blade.php +++ b/resources/views/livewire/home/show-user-favorites.blade.php @@ -6,7 +6,7 @@ {{-- @dump($item) --}}
- diff --git a/resources/views/livewire/os/copy-to-whatsapp-button.blade.php b/resources/views/livewire/os/copy-to-whatsapp-button.blade.php new file mode 100644 index 00000000..f41acf10 --- /dev/null +++ b/resources/views/livewire/os/copy-to-whatsapp-button.blade.php @@ -0,0 +1,41 @@ + + + + diff --git a/resources/views/livewire/os/detalhes-tab.blade.php b/resources/views/livewire/os/detalhes-tab.blade.php index 395f11b0..f59a7a6e 100644 --- a/resources/views/livewire/os/detalhes-tab.blade.php +++ b/resources/views/livewire/os/detalhes-tab.blade.php @@ -222,23 +222,70 @@ tomSelectModelo.addItem(@js($os->modelo_id)); tomSelectCliente.on('change', function (){ - $('#categoria_id').focus(); + tomSelectModelo.focus(); }); tomSelectModelo.on('change', function () { + // Carrega a categoria quando o modelo é alterado + const modeloId = tomSelectModelo.getValue(); + if (modeloId) { + const url = route('modelo.categoria', modeloId); + fetch(url) + .then(response => response.json()) + .then(data => { + if (data.id) { + document.getElementById('categoria_id').value = data.id; + $('#categoria_id').trigger('change'); + } + }) + .catch(error => console.error('Erro ao carregar categoria:', error)); + } $('#status_id').focus(); }); tomSelectTecnico.on('change', function () { - $('#categoria_id').focus(); + tomSelectModelo.focus(); }); $('#categoria_id').on('change', function () { + const categoriaId = $(this).val(); + + // Carrega os dados da categoria (defeito, observacao, laudo) se os campos estiverem vazios + if (categoriaId) { + const url = route('configuracao.parametro.categoria.dados', categoriaId); + fetch(url) + .then(response => response.json()) + .then(data => { + // Só preenche se o campo estiver vazio + if (data.descricao && $('#descricao').summernote('isEmpty')) { + $('#descricao').summernote('code', data.descricao); + } + if (data.defeito && $('#defeito').summernote('isEmpty')) { + $('#defeito').summernote('code', data.defeito); + } + if (data.observacao && $('#observacoes').summernote('isEmpty')) { + $('#observacoes').summernote('code', data.observacao); + } + if (data.laudo && $('#laudo').summernote('isEmpty')) { + $('#laudo').summernote('code', data.laudo); + } + }) + .catch(error => console.error('Erro ao carregar dados da categoria:', error)); + } + tomSelectModelo.focus() }); }); $(document).ready(function() { + let formAlterado = false; + const camposPrincipais = 'input[name="cliente_id"], input[name="tecnico_id"], input[name="categoria_id"], input[name="modelo_id"], input[name="status_id"], input[name="data_entrada"], input[name="data_saida"], input[name="serial"], textarea.texto'; + + // Detecta mudanças apenas nos campos principais da OS, não em elementos adicionados dinamicamente + $(document).on('input change', camposPrincipais, function() { + formAlterado = true; + }); + $('.texto').summernote({ lang: 'pt-BR', height: 300, @@ -252,7 +299,23 @@ [ 'table', [ 'table' ] ], [ 'insert', ['link', 'picture',]], [ 'view', [ 'undo', 'redo', 'codeview', 'fullscreen', 'help' ] ] - ] + ], + callbacks: { + // Isso detecta quando o usuário digita algo dentro do editor Summernote + onChange: function(contents, $editable) { + formAlterado = true; + } + } + }); + window.addEventListener('beforeunload', function (e) { + if (formAlterado) { + // Cancela o evento padrão e define o returnValue (exigência dos navegadores modernos) + e.preventDefault(); + e.returnValue = ''; + } + }); + $('form').on('submit', function() { + formAlterado = false; }); }); }); diff --git a/resources/views/livewire/os/informacoes-tab.blade.php b/resources/views/livewire/os/informacoes-tab.blade.php index 17e0c16a..81512bd9 100644 --- a/resources/views/livewire/os/informacoes-tab.blade.php +++ b/resources/views/livewire/os/informacoes-tab.blade.php @@ -136,6 +136,11 @@