Skip to content

Commit

Permalink
feat: separated all modals
Browse files Browse the repository at this point in the history
  • Loading branch information
kamgrzeski committed Sep 11, 2024
1 parent e1103d8 commit 45bc205
Show file tree
Hide file tree
Showing 23 changed files with 163 additions and 208 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/CRM/ProductsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function processDeleteProduct(ProductsModel $product): \Illuminate\Http\R
{
// Check if the product has any sales records.
if ($product->sales()->count() > 0) {
return redirect()->back()->with('message_error', $this->getMessage('messages.ProductsCannotBeDeleted'));
return redirect()->back()->with('message_error', $this->getMessage('messages.product_first_delete_sales'));
}

// Delete the product.
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@
'product_store' => 'Product has been added.',
'product_delete' => 'Product has been deleted.',
'product_update' => 'Product has been deactivated.',
'product_first_delete_sales' => 'Cannot delete this product, have assigned sales.',
];
19 changes: 19 additions & 0 deletions resources/views/crm/clients/modals/delete_client_modal.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<div class="modal fade" id="deleteClientModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title" id="myModalLabel">You want delete this client?</h4>
</div>
<div class="modal-body">
Action will delete permanently this client.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" style="margin-right: 15px;">
Close
</button>
@include('crm.clients.forms.delete_client_form')
</div>
</div>
</div>
</div>
34 changes: 8 additions & 26 deletions resources/views/crm/clients/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
<ul class="nav nav-tabs">
<li class="active"><a href="#home" data-toggle="tab">Basic information</a>
</li>
<li class=""><a href="#profile" data-toggle="tab">Assigned companies <span
class="badge badge-warning">{{ count($clientDetails->companies) }}</span></a>
<li class="">
<a href="#profile" data-toggle="tab">Assigned companies <span class="badge badge-warning">{{ count($clientDetails->companies) }}</span></a>
</li>
<li class=""><a href="#messages" data-toggle="tab">Assigned employees <span
class="badge badge-warning">{{ count($clientDetails->employees) }}</span></a>
<li class="">
<a href="#messages" data-toggle="tab">Assigned employees <span class="badge badge-warning">{{ count($clientDetails->employees) }}</span></a>
</li>
<div class="text-right">
<button class="btn btn-danger" data-toggle="modal" data-target="#myModal">
<button class="btn btn-danger" data-toggle="modal" data-target="#deleteClientModal">
Delete this client
<li class="fa fa-trash-o"></li>
</button>
Expand Down Expand Up @@ -51,8 +51,7 @@ class="badge badge-warning">{{ count($clientDetails->employees) }}</span></a>
<tr>
<th>Budget</th>
<td>
<button type="submit"
class="btn btn-default">{{ $clientDetails->formattedBudget }}</button>
<button type="submit" class="btn btn-default">{{ $clientDetails->formattedBudget }}</button>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -114,23 +113,6 @@ class="btn btn-default">{{ $clientDetails->formattedBudget }}</button>
</div>
</div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title" id="myModalLabel">You want delete this client?</h4>
</div>
<div class="modal-body">
Action will delete permanently this client.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" style="margin-right: 15px;">
Close
</button>
@include('crm.clients.forms.delete_client_form')
</div>
</div>
</div>
</div>

@include('crm.clients.modals.delete_client_modal')
@endsection
6 changes: 2 additions & 4 deletions resources/views/crm/companies/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@
<td class="text-center">
@if($value->is_active)
<label class="switch">
<input type="checkbox"
onchange='window.location.assign("{{ URL::to('companies/set-active/' . $value->id . '/0') }}")' checked>
<input type="checkbox" onchange='window.location.assign("{{ URL::to('companies/set-active/' . $value->id . '/0') }}")' checked>
<span class="slider"></span>
</label>
@else
<label class="switch">
<input type="checkbox"
onchange='window.location.assign("{{ URL::to('companies/set-active/' . $value->id . '/1') }}")'>
<input type="checkbox" onchange='window.location.assign("{{ URL::to('companies/set-active/' . $value->id . '/1') }}")'>
<span class="slider"></span>
</label>
@endif
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="modal fade" id="deleteCompanyModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title" id="myModalLabel">You want delete this company?</h4>
</div>
<div class="modal-body">
Action will delete permanently this company.
</div>
<div class="modal-footer">
@include('crm.companies.forms.delete_company_form')
</div>
</div>
</div>
</div>
25 changes: 5 additions & 20 deletions resources/views/crm/companies/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@
</div>
<div class="panel-body">
<ul class="nav nav-tabs">
<li class="active"><a href="#home" data-toggle="tab">Basic information</a>
<li class="active">
<a href="#home" data-toggle="tab">Basic information</a>
</li>
<div class="text-right">
<button class="btn btn-danger" data-toggle="modal" data-target="#myModal">
<button class="btn btn-danger" data-toggle="modal" data-target="#deleteCompanyModal">
Delete this company <li class="fa fa-trash-o"></li>
</button>
</div>
</ul>
<div class="tab-content">
<div class="tab-pane fade active in" id="home">


<table class="table table-striped table-bordered">
<tbody class="text-right">
<tr>
Expand Down Expand Up @@ -91,20 +90,6 @@
</div>
</div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title" id="myModalLabel">You want delete this company?</h4>
</div>
<div class="modal-body">
Action will delete permanently this company.
</div>
<div class="modal-footer">
@include('crm.companies.forms.delete_company_form')
</div>
</div>
</div>
</div>

@include('crm.companies.modals.delete_company_modal')
@endsection
3 changes: 1 addition & 2 deletions resources/views/crm/deals/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
@section('content')
@if(count($companies) == 0)
<div class="alert alert-danger">
<strong>Danger!</strong> There is no company in system. Please create one. <a
href="{{ URL::to('companies/create') }}">Click here!</a>
<strong>Danger!</strong> There is no company in system. Please create one. <a href="{{ URL::to('companies/create') }}">Click here!</a>
</div>
@endif

Expand Down
11 changes: 6 additions & 5 deletions resources/views/crm/deals/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@

<div class="panel-body">
<ul class="nav nav-tabs">
<li class="active"><a href="#home" data-toggle="tab">The basic information</a>
<li class="active">
<a href="#home" data-toggle="tab">The basic information</a>
</li>
<li class=""><a href="#profile" data-toggle="tab">Company</a>
<li class="">
<a href="#profile" data-toggle="tab">Company</a>
</li>
<li class=""><a href="#storeDealTerm" data-toggle="tab">Terms of agreement <span class="badge badge-danger">VERY IMPORTANT</span></a>
<li class="">
<a href="#storeDealTerm" data-toggle="tab">Terms of agreement <span class="badge badge-danger">VERY IMPORTANT</span></a>
</li>
<div class="text-right">
<button class="btn btn-danger" data-toggle="modal" data-target="#deleteDealTermModal">
Expand All @@ -32,8 +35,6 @@

<div class="tab-content">
<div class="tab-pane fade active in" id="home">


<table class="table table-striped table-bordered">
<tbody class="text-right">
<tr>
Expand Down
9 changes: 3 additions & 6 deletions resources/views/crm/employees/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,19 @@
<td class="text-center">
@if($value->is_active)
<label class="switch">
<input type="checkbox"
onchange='window.location.assign("{{ URL::to('employees/set-active/' . $value->id . '/0') }}")' checked>
<input type="checkbox" onchange='window.location.assign("{{ URL::to('employees/set-active/' . $value->id . '/0') }}")' checked>
<span class="slider"></span>
</label>
@else
<label class="switch">
<input type="checkbox"
onchange='window.location.assign("{{ URL::to('employees/set-active/' . $value->id . '/1') }}")'>
<input type="checkbox" onchange='window.location.assign("{{ URL::to('employees/set-active/' . $value->id . '/1') }}")'>
<span class="slider"></span>
</label>
@endif
</td>
<td class="text-right" style="text-align: center">
<div class="btn-group">
<a class="btn btn-small btn-primary"
href="{{ URL::to('employees/view/' . $value->id) }}">More information</a>
<a class="btn btn-small btn-primary" href="{{ URL::to('employees/view/' . $value->id) }}">More information</a>
<button data-toggle="dropdown" class="btn btn-primary dropdown-toggle"><span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="{{ URL::to('employees/form/update/' . $value->id) }}">Edit</a></li>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="modal fade" id="deleteEmployeeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title" id="myModalLabel">You want delete this employee?</h4>
</div>
<div class="modal-body">
Action will delete permanently this employees.
</div>
<div class="modal-footer">
@include('crm.employees.forms.delete_employee')
</div>
</div>
</div>
</div>
31 changes: 7 additions & 24 deletions resources/views/crm/employees/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@
</div>
<div class="panel-body">
<ul class="nav nav-tabs">
<li class="active"><a href="#home" data-toggle="tab">Basic information</a>
<li class="active">
<a href="#home" data-toggle="tab">Basic information</a>
</li>
<li class=""><a href="#profile" data-toggle="tab">Tasks <span
class="badge badge-warning">{{ $employee->taskCount }}</span></a>
<li class="">
<a href="#profile" data-toggle="tab">Tasks <span class="badge badge-warning">{{ $employee->taskCount }}</span></a>
</li>
<div class="text-right">
<button class="btn btn-danger" data-toggle="modal" data-target="#myModal">
<button class="btn btn-danger" data-toggle="modal" data-target="#deleteEmployeeModal">
Delete this employee <li class="fa fa-trash-o"></li>
</button>
</div>
</ul>

<div class="tab-content">
<div class="tab-pane fade active in" id="home">


<table class="table table-striped table-bordered">
<tbody class="text-right">
<tr>
Expand Down Expand Up @@ -69,22 +68,21 @@ class="badge badge-warning">{{ $employee->taskCount }}</span></a>
</table>
</div>
<div class="tab-pane fade" id="profile">
<br>
<table class="table table-striped table-bordered table-hover" id="dataTables-example" data-sortable>
<thead>
<tr>
<th>Name</th>
<th>Action</th>
</tr>
</thead>
</tr>
@foreach($employee->tasks as $tasks)
<tbody>
<tr class="odd gradeX">
<td>{{ $tasks->name }}</td>
<td>
<a class="btn btn-small btn-primary" href="{{ URL::to('tasks/view/' . $tasks->id) }}">More information</a>
</td>
</tr>
@endforeach
</tbody>
</table>
Expand All @@ -95,20 +93,5 @@ class="badge badge-warning">{{ $employee->taskCount }}</span></a>
</div>
</div>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title" id="myModalLabel">You want delete this employee?</h4>
</div>
<div class="modal-body">
Action will delete permanently this employees.
</div>
<div class="modal-footer">
@include('crm.employees.forms.delete_employee')
</div>
</div>
</div>
</div>
@include('crm.employees.modals.delete_employee_modal')
@endsection
3 changes: 1 addition & 2 deletions resources/views/crm/finances/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
@section('content')
@if(count($companies) == 0)
<div class="alert alert-danger">
<strong>Danger!</strong> There is no companies in system. Please create any client. <a
href="{{ URL::to('companies/create') }}">Click here!</a>
<strong>Danger!</strong> There is no companies in system. Please create any client. <a href="{{ URL::to('companies/create') }}">Click here!</a>
</div>
@endif

Expand Down
6 changes: 3 additions & 3 deletions resources/views/crm/finances/edit.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@extends('layouts.base')

@section('caption', 'Edit empoloyees')
@section('caption', 'Edit employees')

@section('title', 'Edit empoloyees')
@section('title', 'Edit employees')

@section('lyric', 'lorem ipsum')
@section('lyric', '')

@section('content')

Expand Down
Loading

0 comments on commit 45bc205

Please sign in to comment.