Commit f06f5fa4 authored by Viral Solani's avatar Viral Solani

Refactoring User Module

parent 0976330d
......@@ -4,7 +4,7 @@
## Introduction
* This is a laravel Admin Panel, based on [Rappasoft Laravel Boilerplate](https://github.com/rappasoft/laravel-5-boilerplate), with enhancemenets and many modules pre-made, just for you.
* This is a laravel Admin Panel, based on [Rappasoft Laravel Boilerplate](https://github.com/rappasoft/laravel-5-boilerplate/releases/tag/4.5.7), with enhancemenets and many modules pre-made, just for you.
* The project is taken to Laravel 5.5 so we can develop from the latest Laravel.
## Features
......
......@@ -57,8 +57,9 @@ class UserController extends Controller
*/
public function create(CreateUserRequest $request)
{
return view('backend.access.create')
->withRoles($this->roles->getAll());
return view('backend.access.create')->with([
'roles' => $this->roles->getAll()
]);
}
/**
......@@ -93,11 +94,21 @@ class UserController extends Controller
*/
public function edit(User $user, EditUserRequest $request)
{
//@todo move queries in to repositery
$userPermissions = DB::table('permission_user')->where('user_id', $user->id)->pluck('permission_id', 'permission_id')->toArray();
$permissions = DB::table('permissions')->pluck('display_name', 'id')->toArray();
ksort($userPermissions);
ksort($permissions);
/*return view('backend.access.edit')->with([
'user' => $user,
'userRoles' => $user->roles->pluck('id')->all(),
'roles' => $this->roles->getAll(),
'userPermissions' => $userPermissions,
'permissions' => $permissions
]);*/
return view('backend.access.edit', compact('userPermissions', 'permissions'))
->withUser($user)
->withUserRoles($user->roles->pluck('id')->all())
......
......@@ -40,16 +40,11 @@ class User extends Authenticatable
'last_name',
'email',
'password',
'address',
'country_id',
'state_id',
'city_id',
'zip_code',
'ssn',
'status',
'confirmation_code',
'confirmed',
'created_by',
'updated_by'
];
/**
......
var FinBuilders = {
var Backend = {
/**
......@@ -9,7 +9,7 @@ var FinBuilders = {
{
init: function()
{
FinBuilders.tinyMCE.init();
Backend.tinyMCE.init();
},
},
......@@ -51,7 +51,7 @@ var FinBuilders = {
init: function ()
{
this.addHandlers();
FinBuilders.tinyMCE.init();
Backend.tinyMCE.init();
},
addHandlers: function ()
......@@ -121,23 +121,23 @@ var FinBuilders = {
},
init: function () {
FinBuilders.emailTemplate.addHandlers();
FinBuilders.tinyMCE.init();
Backend.emailTemplate.addHandlers();
Backend.tinyMCE.init();
},
// ! FinBuilders.emailTemplate.addHandlers
// ! Backend.emailTemplate.addHandlers
addHandlers: function () {
// to add placeholder in to active textarea
$("#addPlaceHolder").on('click', function (event) {
FinBuilders.emailTemplate.addPlaceHolder(event);
Backend.emailTemplate.addPlaceHolder(event);
});
$("#showPreview").on('click', function (event) {
FinBuilders.emailTemplate.showPreview(event);
Backend.emailTemplate.showPreview(event);
});
this.selectors.emailtemplateSelection.select2();
},
// ! FinBuilders.emailTemplate.addPlaceHolder
// ! Backend.emailTemplate.addPlaceHolder
addPlaceHolder: function (event) {
var placeHolder = $('#placeHolder').val();
if (placeHolder != '') {
......@@ -145,7 +145,7 @@ var FinBuilders = {
}
},
// ! FinBuilders.emailTemplate.showPreview
// ! Backend.emailTemplate.showPreview
showPreview: function (event) {
jQuery( ".modal-body" ).html(tinyMCE.get('txtBody').getContent());
$(".model-wrapper").modal('show');
......@@ -165,7 +165,7 @@ var FinBuilders = {
init: function ()
{
// this.addHandlers();
FinBuilders.tinyMCE.init();
Backend.tinyMCE.init();
},
addHandlers: function ()
......
......@@ -5,6 +5,6 @@
"/css/frontend.css": "/css/frontend.3af0a6cbd7d1d8d042f2a37e97008b7c.css",
"/css/backend.css": "/css/backend.f8550f50504e5b8ef6055285205f223a.css",
"/css/backend-custom.css": "/css/backend-custom.50f14193ab908e3cf471dea6cb6616ae.css",
"/js/backend-custom.js": "/js/backend-custom.d305fff90b4defcf757b268abb9a683c.js",
"/js/backend-custom.js": "/js/backend-custom.76b8496e1c3f25676c8dc7b0f243e416.js",
"/js/dataTable.js": "/js/dataTable.f968d300a6a0b871f138f114361259c8.js"
}
\ No newline at end of file
......@@ -212,44 +212,7 @@
<script type="text/javascript">
$(document).ready(function() {
FinBuilders.Access.init();
//Getting States of default contry
ajaxCall("{{route('admin.get.states')}}");
//Getting Cities of select State
$("#state").on("change", function() {
var stateId = $(this).val();
var url = "{{route('admin.get.cities')}}";
ajaxCall(url, stateId);
});
function ajaxCall(url, data = null)
{
$.ajax({
url: url,
type: "POST",
data: {stateId: data},
success: function(result) {
if(result != null)
{
var options;
$.each(result.data, function(key, value) {
options += "<option value='" + key + "'>" + value + "</option>";
});
if(result.status == "city")
{
$("#city").html('');
$("#city").append(options);
}
else
{
$("#state").append(options);
}
}
}
});
}
Backend.Access.init();
/**
* This function is used to get clicked element role id and return required result
......
......@@ -101,7 +101,7 @@
}
});
FinBuilders.DataTableSearch.init(dataTable);
Backend.DataTableSearch.init(dataTable);
});
</script>
@endsection
......@@ -101,7 +101,7 @@
}
});
FinBuilders.DataTableSearch.init(dataTable);
Backend.DataTableSearch.init(dataTable);
$("body").on("click", "a[name='delete_user_perm']", function(e) {
e.preventDefault();
......
......@@ -203,7 +203,7 @@
//Getting States of default contry
ajaxCall("{{route('admin.get.states')}}");
FinBuilders.Access.init();
Backend.Access.init();
//Getting Cities of select State
$("#state").on("change", function() {
......
......@@ -115,7 +115,7 @@
}
});
FinBuilders.DataTableSearch.init(dataTable);
Backend.DataTableSearch.init(dataTable);
});
</script>
@endsection
......@@ -95,7 +95,7 @@
}
});
FinBuilders.DataTableSearch.init(dataTable);
Backend.DataTableSearch.init(dataTable);
});
......
......@@ -82,7 +82,7 @@
<script type="text/javascript">
$(document).ready(function() {
FinBuilders.Profile.init();
Backend.Profile.init();
//Getting States of default contry
ajaxCall("{{route('admin.get.states')}}");
......
......@@ -90,7 +90,7 @@
{{ Html::script('js/backend/access/roles/script.js') }}
<script type="text/javascript">
$(document).ready(function() {
FinBuilders.Access.init();
Backend.Access.init();
});
</script>
@endsection
......@@ -82,7 +82,7 @@
{{ Html::script('js/backend/access/roles/script.js') }}
<script type="text/javascript">
$(document).ready(function() {
FinBuilders.Access.init();
Backend.Access.init();
});
</script>
@endsection
\ No newline at end of file
......@@ -98,7 +98,7 @@
}
});
FinBuilders.DataTableSearch.init(dataTable);
Backend.DataTableSearch.init(dataTable);
});
</script>
@endsection
\ No newline at end of file
......@@ -94,7 +94,7 @@
}
});
FinBuilders.DataTableSearch.init(dataTable);
Backend.DataTableSearch.init(dataTable);
});
</script>
@endsection
\ No newline at end of file
......@@ -125,7 +125,7 @@
@section("after-scripts")
<script type="text/javascript">
FinBuilders.Blog.init();
Backend.Blog.init();
//For Blog datetimepicker for publish_datetime
$('#datetimepicker1').datetimepicker();
......
......@@ -97,7 +97,7 @@
}
});
FinBuilders.DataTableSearch.init(dataTable);
Backend.DataTableSearch.init(dataTable);
});
</script>
@endsection
\ No newline at end of file
......@@ -94,7 +94,7 @@
}
});
FinBuilders.DataTableSearch.init(dataTable);
Backend.DataTableSearch.init(dataTable);
});
</script>
@endsection
\ No newline at end of file
......@@ -93,6 +93,6 @@
@endsection
@section("after-scripts")
<script type="text/javascript">
FinBuilders.Cmspage.init();
Backend.Cmspage.init();
</script>
@endsection
......@@ -93,6 +93,6 @@
@endsection
@section("after-scripts")
<script type="text/javascript">
FinBuilders.Cmspage.init();
Backend.Cmspage.init();
</script>
@endsection
\ No newline at end of file
......@@ -94,7 +94,7 @@
}
});
FinBuilders.DataTableSearch.init(dataTable);
Backend.DataTableSearch.init(dataTable);
});
</script>
@endsection
\ No newline at end of file
......@@ -107,6 +107,6 @@
@endsection
@section("after-scripts")
<script type="text/javascript">
FinBuilders.emailTemplate.init();
Backend.emailTemplate.init();
</script>
@endsection
\ No newline at end of file
......@@ -113,7 +113,7 @@
}
});
FinBuilders.DataTableSearch.init(dataTable);
Backend.DataTableSearch.init(dataTable);
});
</script>
@endsection
\ No newline at end of file
......@@ -34,6 +34,6 @@
</div>
@section('after-scripts')
<script type="text/javascript">
FinBuilders.Faq.init();
Backend.Faq.init();
</script>
@endsection
\ No newline at end of file
......@@ -98,7 +98,7 @@
}
});
FinBuilders.DataTableSearch.init(dataTable);
Backend.DataTableSearch.init(dataTable);
});
</script>
@endsection
\ No newline at end of file
......@@ -135,7 +135,7 @@
$(document).ready(function() {
// To Use Select2
FinBuilders.Select2.init();
Backend.Select2.init();
//Getting States of default contry
ajaxCall("{{route('frontend.get.states')}}");
......
......@@ -66,7 +66,7 @@
$(document).ready(function() {
// To Use Select2
FinBuilders.Select2.init();
Backend.Select2.init();
if($.session.get("tab") == "edit")
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment