fully working now
This commit is contained in:
27
crm-panel/resources/views/companies/create.blade.php
Normal file
27
crm-panel/resources/views/companies/create.blade.php
Normal file
@ -0,0 +1,27 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h1>Add Company</h1>
|
||||
<form action="{{ route('companies.store') }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="form-group mb-3">
|
||||
<label for="name">Name</label>
|
||||
<input type="text" name="name" class="form-control" required>
|
||||
</div>
|
||||
<div class="form-group mb-3">
|
||||
<label for="email">Email</label>
|
||||
<input type="email" name="email" class="form-control">
|
||||
</div>
|
||||
<div class="form-group mb-3">
|
||||
<label for="logo">Logo (min: 100x100)</label>
|
||||
<input type="file" name="logo" class="form-control">
|
||||
</div>
|
||||
<div class="form-group mb-3">
|
||||
<label for="website">Website</label>
|
||||
<input type="url" name="website" class="form-control">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success">Save</button>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
31
crm-panel/resources/views/companies/edit.blade.php
Normal file
31
crm-panel/resources/views/companies/edit.blade.php
Normal file
@ -0,0 +1,31 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h1>Edit Company</h1>
|
||||
<form action="{{ route('companies.update', $company) }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="form-group mb-3">
|
||||
<label for="name">Name</label>
|
||||
<input type="text" name="name" class="form-control" value="{{ $company->name }}" required>
|
||||
</div>
|
||||
<div class="form-group mb-3">
|
||||
<label for="email">Email</label>
|
||||
<input type="email" name="email" class="form-control" value="{{ $company->email }}">
|
||||
</div>
|
||||
<div class="form-group mb-3">
|
||||
<label for="logo">Logo (min: 100x100)</label>
|
||||
<input type="file" name="logo" class="form-control">
|
||||
@if($company->logo)
|
||||
<img src="{{ Storage::url($company->logo) }}" alt="Logo" width="100" class="mt-2">
|
||||
@endif
|
||||
</div>
|
||||
<div class="form-group mb-3">
|
||||
<label for="website">Website</label>
|
||||
<input type="url" name="website" class="form-control" value="{{ $company->website }}">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success">Update</button>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
50
crm-panel/resources/views/companies/index.blade.php
Normal file
50
crm-panel/resources/views/companies/index.blade.php
Normal file
@ -0,0 +1,50 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h1>Companies</h1>
|
||||
<a href="{{ route('companies.create') }}" class="btn btn-primary mb-3">Add Company</a>
|
||||
|
||||
@if (session('success'))
|
||||
<div class="alert alert-success">{{ session('success') }}</div>
|
||||
@endif
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Email</th>
|
||||
<th>Logo</th>
|
||||
<th>Website</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($companies as $company)
|
||||
<tr>
|
||||
<td>{{ $company->name }}</td>
|
||||
<td>{{ $company->email }}</td>
|
||||
<td>
|
||||
@if($company->logo)
|
||||
<img src="{{ Storage::url($company->logo) }}" alt="Logo" width="100">
|
||||
@else
|
||||
N/A
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $company->website }}</td>
|
||||
<td>
|
||||
<a href="{{ route('companies.show', $company) }}" class="btn btn-info btn-sm">View</a>
|
||||
<a href="{{ route('companies.edit', $company) }}" class="btn btn-warning btn-sm">Edit</a>
|
||||
<form action="{{ route('companies.destroy', $company) }}" method="POST" style="display:inline;">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?')">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
{{ $companies->links() }}
|
||||
</div>
|
||||
@endsection
|
21
crm-panel/resources/views/companies/show.blade.php
Normal file
21
crm-panel/resources/views/companies/show.blade.php
Normal file
@ -0,0 +1,21 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h1>Company Details</h1>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item"><strong>Name:</strong> {{ $company->name }}</li>
|
||||
<li class="list-group-item"><strong>Email:</strong> {{ $company->email }}</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Logo:</strong>
|
||||
@if($company->logo)
|
||||
<img src="{{ Storage::url($company->logo) }}" alt="Logo" width="100">
|
||||
@else
|
||||
N/A
|
||||
@endif
|
||||
</li>
|
||||
<li class="list-group-item"><strong>Website:</strong> {{ $company->website }}</li>
|
||||
</ul>
|
||||
<a href="{{ route('companies.index') }}" class="btn btn-secondary mt-3">Back to List</a>
|
||||
</div>
|
||||
@endsection
|
@ -1,12 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Dashboard</title>
|
||||
</head>
|
||||
<body>
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container mt-5">
|
||||
<h1>Dashboard</h1>
|
||||
<a href="{{ url('/') }}">Back to Home</a>
|
||||
</body>
|
||||
</html>
|
||||
<div class="d-flex gap-3 mt-3">
|
||||
<a href="{{ route('companies.index') }}" class="btn btn-primary">Manage Companies</a>
|
||||
<a href="{{ route('employees.index') }}" class="btn btn-secondary">Manage Employees</a>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
37
crm-panel/resources/views/employees/create.blade.php
Normal file
37
crm-panel/resources/views/employees/create.blade.php
Normal file
@ -0,0 +1,37 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h1>Add New Employee</h1>
|
||||
|
||||
<form action="{{ route('employees.store') }}" method="POST">
|
||||
@csrf
|
||||
<div class="mb-3">
|
||||
<label for="first_name" class="form-label">First Name</label>
|
||||
<input type="text" class="form-control" id="first_name" name="first_name" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="last_name" class="form-label">Last Name</label>
|
||||
<input type="text" class="form-control" id="last_name" name="last_name" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="company_id" class="form-label">Company</label>
|
||||
<select class="form-select" id="company_id" name="company_id" required>
|
||||
<option value="">Select Company</option>
|
||||
@foreach($companies as $company)
|
||||
<option value="{{ $company->id }}">{{ $company->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label">Email</label>
|
||||
<input type="email" class="form-control" id="email" name="email">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="phone" class="form-label">Phone</label>
|
||||
<input type="text" class="form-control" id="phone" name="phone">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Save Employee</button>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
37
crm-panel/resources/views/employees/edit.blade.php
Normal file
37
crm-panel/resources/views/employees/edit.blade.php
Normal file
@ -0,0 +1,37 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h1>Edit Employee</h1>
|
||||
|
||||
<form action="{{ route('employees.update', $employee) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="mb-3">
|
||||
<label for="first_name" class="form-label">First Name</label>
|
||||
<input type="text" class="form-control" id="first_name" name="first_name" value="{{ old('first_name', $employee->first_name) }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="last_name" class="form-label">Last Name</label>
|
||||
<input type="text" class="form-control" id="last_name" name="last_name" value="{{ old('last_name', $employee->last_name) }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="company_id" class="form-label">Company</label>
|
||||
<select class="form-select" id="company_id" name="company_id" required>
|
||||
@foreach($companies as $company)
|
||||
<option value="{{ $company->id }}" {{ $employee->company_id == $company->id ? 'selected' : '' }}>{{ $company->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label">Email</label>
|
||||
<input type="email" class="form-control" id="email" name="email" value="{{ old('email', $employee->email) }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="phone" class="form-label">Phone</label>
|
||||
<input type="text" class="form-control" id="phone" name="phone" value="{{ old('phone', $employee->phone) }}">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Update Employee</button>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
42
crm-panel/resources/views/employees/index.blade.php
Normal file
42
crm-panel/resources/views/employees/index.blade.php
Normal file
@ -0,0 +1,42 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h1>Employees</h1>
|
||||
<a href="{{ route('employees.create') }}" class="btn btn-primary mb-3">Add Employee</a>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>First Name</th>
|
||||
<th>Last Name</th>
|
||||
<th>Company</th>
|
||||
<th>Email</th>
|
||||
<th>Phone</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($employees as $employee)
|
||||
<tr>
|
||||
<td>{{ $employee->first_name }}</td>
|
||||
<td>{{ $employee->last_name }}</td>
|
||||
<td>{{ $employee->company->name ?? 'N/A' }}</td>
|
||||
<td>{{ $employee->email }}</td>
|
||||
<td>{{ $employee->phone }}</td>
|
||||
<td>
|
||||
<a href="{{ route('employees.show', $employee) }}" class="btn btn-info btn-sm">View</a>
|
||||
<a href="{{ route('employees.edit', $employee) }}" class="btn btn-warning btn-sm">Edit</a>
|
||||
<form action="{{ route('employees.destroy', $employee) }}" method="POST" style="display:inline;">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?')">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
{{ $employees->links() }}
|
||||
</div>
|
||||
@endsection
|
15
crm-panel/resources/views/employees/show.blade.php
Normal file
15
crm-panel/resources/views/employees/show.blade.php
Normal file
@ -0,0 +1,15 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h1>Employee Details</h1>
|
||||
<ul>
|
||||
<li>First Name: {{ $employee->first_name }}</li>
|
||||
<li>Last Name: {{ $employee->last_name }}</li>
|
||||
<li>Company: {{ $employee->company->name ?? 'N/A' }}</li>
|
||||
<li>Email: {{ $employee->email }}</li>
|
||||
<li>Phone: {{ $employee->phone }}</li>
|
||||
</ul>
|
||||
<a href="{{ route('employees.index') }}" class="btn btn-primary">Back to List</a>
|
||||
</div>
|
||||
@endsection
|
@ -18,59 +18,48 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="{{ url('/') }}">
|
||||
{{ config('app.name', 'Laravel') }}
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="{{ url('/dashboard') }}">
|
||||
Admin Panel
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<!-- Left Side Of Navbar -->
|
||||
<ul class="navbar-nav me-auto">
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav me-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ route('dashboard') }}">Dashboard</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ route('companies.index') }}">Companies</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ route('employees.index') }}">Employees</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</ul>
|
||||
<ul class="navbar-nav ms-auto">
|
||||
@guest
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ route('login') }}">Login</a>
|
||||
</li>
|
||||
@else
|
||||
<li class="nav-item">
|
||||
<form action="{{ route('logout') }}" method="POST">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-danger">
|
||||
Logout
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
@endguest
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Right Side Of Navbar -->
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<!-- Authentication Links -->
|
||||
@guest
|
||||
@if (Route::has('login'))
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@if (Route::has('register'))
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
|
||||
</li>
|
||||
@endif
|
||||
@else
|
||||
<li class="nav-item dropdown">
|
||||
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
|
||||
{{ Auth::user()->name }}
|
||||
</a>
|
||||
|
||||
<div class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
|
||||
<a class="dropdown-item" href="{{ route('logout') }}"
|
||||
onclick="event.preventDefault();
|
||||
document.getElementById('logout-form').submit();">
|
||||
{{ __('Logout') }}
|
||||
</a>
|
||||
|
||||
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
|
||||
@csrf
|
||||
</form>
|
||||
</div>
|
||||
</li>
|
||||
@endguest
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="py-4">
|
||||
@yield('content')
|
||||
|
Reference in New Issue
Block a user