This commit is contained in:
Azfar Arsyad
2021-12-05 16:58:02 +08:00
parent 4901f0d29c
commit 9c74e98959
23 changed files with 823 additions and 132 deletions
+70 -9
View File
@@ -7,6 +7,7 @@ use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;
use Illuminate\Support\Facades\Auth;
use App\Models\User;
use PDF;
class PenggunaController extends Controller
{
@@ -64,7 +65,7 @@ class PenggunaController extends Controller
// dd($arraytaraf);
$user->syncRoles($arraytaraf);
return redirect()->route('pengguna.index')
->with('success','Tukar Taraf Berjaya');
->with('success','Kemaskini Berjaya');
}
public function delete($userid)
@@ -120,12 +121,12 @@ class PenggunaController extends Controller
// $user = Auth::user();
// $user->assignRole('admin');
return redirect()->route('pengguna.taraf')
->with('success','Tukar Roles Berjaya');
->with('success','Kemaskini Berjaya');
}
public function deletetaraf($roleid)
public function deletetaraf($tarafid)
{
$taraf = Role::where('id','=',$roleid)->first();
$taraf = Role::where('id','=',$tarafid)->first();
$taraf->delete();
return redirect()->route('pengguna.taraf')
@@ -140,6 +141,20 @@ class PenggunaController extends Controller
return view('pengurusanpengguna.roles',compact('allpermission'));
}
public function showrole($roleid) //roles = permissions in db
{
$permission = Permission::where('id','=',$roleid)->first();
// $user = Auth::user();
// $user->assignRole('admin');
return view('pengurusanpengguna.showrole',compact('permission'));
}
public function storerole(Request $request)
{
$role = Permission::where('id','=',$request->idrole)->first();
return redirect()->route('pengguna.roles')
->with('success','Kemaskini Berjaya');
}
public function updateroles(Request $request)
{
$user = User::where('id','=',$request->id);
@@ -160,12 +175,58 @@ class PenggunaController extends Controller
public function export(Request $request)
{
dd(request()->all());
$data = $request;
$pdf = PDF::loadView('pdf.testpdf', $data);
return $pdf->download('invoice.pdf');
}
if($request->type =='Role' || $request->type =='Permission')
{
$model_name = '\\Spatie\\Permission\\Models\\'.$request->type;
}
else
{
$model_name = '\\App\\Models\\'.$request->type;
}
dd($request->checkboxdata);
if($request->checkboxdata)
{
if($request->type == 'User')
{
$data = $model_name::whereIn('id',$request->checkboxdata)->with('roles')->get();
}
else{
$data = $model_name::whereIn('id',$request->checkboxdata)->get();
}
}
else
{
if($request->type == 'User')
{
$data = $model_name::with('roles')->get();
}
else{
$data = $model_name::all();
}
}
// return view('pdf.edit',compact('data')); //page for editing
// dd($data);
if($request->type =='Role')
{
$pdf = PDF::loadView('pdf.tarafpdf',compact('data'));
return $pdf->download('Taraf.pdf');
}
elseif($request->type =='User')
{
// return view('pdf.edit',compact('data')); //page for editing
$pdf = PDF::loadView('pdf.penggunapdf',compact('data'));
return $pdf->download('Pengguna.pdf');
}
elseif($request->type =='Permission')
{
return view('pdf.edit',compact('data')); //page for editing
// $pdf = PDF::loadView('pdf.rolespdf',compact('data'));
// return $pdf->download('Roles.pdf');
}
}
}
+1 -1
View File
@@ -19,7 +19,7 @@ class User extends Authenticatable
* @var string[]
*/
protected $fillable = [
'nama',
'name',
'email',
'password',
'kodcaw',
+2
View File
@@ -174,6 +174,7 @@ return [
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Barryvdh\DomPDF\ServiceProvider::class,
],
@@ -229,6 +230,7 @@ return [
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'PDF' => Barryvdh\DomPDF\Facade::class,
],
+244
View File
@@ -0,0 +1,244 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Settings
|--------------------------------------------------------------------------
|
| Set some default values. It is possible to add all defines that can be set
| in dompdf_config.inc.php. You can also override the entire config file.
|
*/
'show_warnings' => false, // Throw an Exception on warnings from dompdf
'orientation' => 'portrait',
'defines' => array(
/**
* The location of the DOMPDF font directory
*
* The location of the directory where DOMPDF will store fonts and font metrics
* Note: This directory must exist and be writable by the webserver process.
* *Please note the trailing slash.*
*
* Notes regarding fonts:
* Additional .afm font metrics can be added by executing load_font.php from command line.
*
* Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must
* be embedded in the pdf file or the PDF may not display correctly. This can significantly
* increase file size unless font subsetting is enabled. Before embedding a font please
* review your rights under the font license.
*
* Any font specification in the source HTML is translated to the closest font available
* in the font directory.
*
* The pdf standard "Base 14 fonts" are:
* Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique,
* Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique,
* Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic,
* Symbol, ZapfDingbats.
*/
"font_dir" => storage_path('fonts/'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782)
/**
* The location of the DOMPDF font cache directory
*
* This directory contains the cached font metrics for the fonts used by DOMPDF.
* This directory can be the same as DOMPDF_FONT_DIR
*
* Note: This directory must exist and be writable by the webserver process.
*/
"font_cache" => storage_path('fonts/'),
/**
* The location of a temporary directory.
*
* The directory specified must be writeable by the webserver process.
* The temporary directory is required to download remote images and when
* using the PFDLib back end.
*/
"temp_dir" => sys_get_temp_dir(),
/**
* ==== IMPORTANT ====
*
* dompdf's "chroot": Prevents dompdf from accessing system files or other
* files on the webserver. All local files opened by dompdf must be in a
* subdirectory of this directory. DO NOT set it to '/' since this could
* allow an attacker to use dompdf to read any files on the server. This
* should be an absolute path.
* This is only checked on command line call by dompdf.php, but not by
* direct class use like:
* $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
*/
"chroot" => realpath(base_path()),
/**
* Whether to enable font subsetting or not.
*/
"enable_font_subsetting" => false,
/**
* The PDF rendering backend to use
*
* Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and
* 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will
* fall back on CPDF. 'GD' renders PDFs to graphic files. {@link
* Canvas_Factory} ultimately determines which rendering class to instantiate
* based on this setting.
*
* Both PDFLib & CPDF rendering backends provide sufficient rendering
* capabilities for dompdf, however additional features (e.g. object,
* image and font support, etc.) differ between backends. Please see
* {@link PDFLib_Adapter} for more information on the PDFLib backend
* and {@link CPDF_Adapter} and lib/class.pdf.php for more information
* on CPDF. Also see the documentation for each backend at the links
* below.
*
* The GD rendering backend is a little different than PDFLib and
* CPDF. Several features of CPDF and PDFLib are not supported or do
* not make any sense when creating image files. For example,
* multiple pages are not supported, nor are PDF 'objects'. Have a
* look at {@link GD_Adapter} for more information. GD support is
* experimental, so use it at your own risk.
*
* @link http://www.pdflib.com
* @link http://www.ros.co.nz/pdf
* @link http://www.php.net/image
*/
"pdf_backend" => "CPDF",
/**
* PDFlib license key
*
* If you are using a licensed, commercial version of PDFlib, specify
* your license key here. If you are using PDFlib-Lite or are evaluating
* the commercial version of PDFlib, comment out this setting.
*
* @link http://www.pdflib.com
*
* If pdflib present in web server and auto or selected explicitely above,
* a real license code must exist!
*/
//"DOMPDF_PDFLIB_LICENSE" => "your license key here",
/**
* html target media view which should be rendered into pdf.
* List of types and parsing rules for future extensions:
* http://www.w3.org/TR/REC-html40/types.html
* screen, tty, tv, projection, handheld, print, braille, aural, all
* Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3.
* Note, even though the generated pdf file is intended for print output,
* the desired content might be different (e.g. screen or projection view of html file).
* Therefore allow specification of content here.
*/
"default_media_type" => "screen",
/**
* The default paper size.
*
* North America standard is "letter"; other countries generally "a4"
*
* @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.)
*/
"default_paper_size" => "a4",
/**
* The default font family
*
* Used if no suitable fonts can be found. This must exist in the font folder.
* @var string
*/
"default_font" => "serif",
/**
* Image DPI setting
*
* This setting determines the default DPI setting for images and fonts. The
* DPI may be overridden for inline images by explictly setting the
* image's width & height style attributes (i.e. if the image's native
* width is 600 pixels and you specify the image's width as 72 points,
* the image will have a DPI of 600 in the rendered PDF. The DPI of
* background images can not be overridden and is controlled entirely
* via this parameter.
*
* For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
* If a size in html is given as px (or without unit as image size),
* this tells the corresponding size in pt.
* This adjusts the relative sizes to be similar to the rendering of the
* html page in a reference browser.
*
* In pdf, always 1 pt = 1/72 inch
*
* Rendering resolution of various browsers in px per inch:
* Windows Firefox and Internet Explorer:
* SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
* Linux Firefox:
* about:config *resolution: Default:96
* (xorg screen dimension in mm and Desktop font dpi settings are ignored)
*
* Take care about extra font/image zoom factor of browser.
*
* In images, <img> size in pixel attribute, img css style, are overriding
* the real image dimension in px for rendering.
*
* @var int
*/
"dpi" => 96,
/**
* Enable inline PHP
*
* If this setting is set to true then DOMPDF will automatically evaluate
* inline PHP contained within <script type="text/php"> ... </script> tags.
*
* Enabling this for documents you do not trust (e.g. arbitrary remote html
* pages) is a security risk. Set this option to false if you wish to process
* untrusted documents.
*
* @var bool
*/
"enable_php" => false,
/**
* Enable inline Javascript
*
* If this setting is set to true then DOMPDF will automatically insert
* JavaScript code contained within <script type="text/javascript"> ... </script> tags.
*
* @var bool
*/
"enable_javascript" => true,
/**
* Enable remote file access
*
* If this setting is set to true, DOMPDF will access remote sites for
* images and CSS files as required.
* This is required for part of test case www/test/image_variants.html through www/examples.php
*
* Attention!
* This can be a security risk, in particular in combination with DOMPDF_ENABLE_PHP and
* allowing remote access to dompdf.php or on allowing remote html code to be passed to
* $dompdf = new DOMPDF(, $dompdf->load_html(...,
* This allows anonymous users to download legally doubtful internet content which on
* tracing back appears to being downloaded by your server, or allows malicious php code
* in remote html pages to be executed by your server with your account privileges.
*
* @var bool
*/
"enable_remote" => true,
/**
* A ratio applied to the fonts height to be more like browsers' line height
*/
"font_height_ratio" => 1.1,
/**
* Use the more-than-experimental HTML5 Lib parser
*/
"enable_html5_parser" => false,
),
);
+1 -1
View File
@@ -15,7 +15,7 @@ class UserFactory extends Factory
public function definition()
{
return [
'nama' => $this->faker->name(),
'name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
't_daftar' => now(),
'status' => 'active',
@@ -15,7 +15,7 @@ class CreateUsersTable extends Migration
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('nama');
$table->string('name');
$table->string('kodcaw')->nullable();
$table->string('nokp')->nullable();
$table->string('bank_acc_pembeli')->nullable();
@@ -27,11 +27,12 @@ class CreatePermissionTables extends Migration
Schema::create($tableNames['permissions'], function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name'); // For MySQL 8.0 use string('name', 125);
$table->string('name');
$table->string('description'); // For MySQL 8.0 use string('name', 125);
$table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
$table->timestamps();
$table->unique(['name', 'guard_name']);
$table->unique(['name','description','guard_name']);
});
Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) {
+87 -28
View File
@@ -21,33 +21,92 @@ class RolesSeeder extends Seeder
// create permissions
//admin
Permission::create(['name' => 'pengguna']);
Permission::create(['name' => 'pengurusanlelongan']);
Permission::create(['name' => 'analisa']);
Permission::create([
'name' => 'pengguna',
'description' => 'Pengurusan Pengguna'
]);
Permission::create([
'name' => 'pengurusanlelongan',
'description' => 'Pengurusan Lelong'
]);
Permission::create([
'name' => 'analisa',
'description' => 'Analisa lelong'
]);
//khazanah
Permission::create(['name' => 'semakanmarhun']);
Permission::create(['name' => 'kemaskinimarhun']);
Permission::create([
'name' => 'semakanmarhun',
'description' => 'Semakan marhun'
]);
Permission::create([
'name' => 'kemaskinimarhun',
'description' => 'Kemaskini marhun'
]);
//teller
Permission::create(['name' => 'pengesahanbayarancash']);
Permission::create([
'name' => 'pengesahanbayarancash',
'description' => 'Pengesahan bayaran pembida di cawangan (cash)'
]);
//pengurus cawangan
Permission::create(['name' => 'pendaftaranpembida']);
Permission::create(['name' => 'jananotis']);
Permission::create([
'name' => 'pendaftaranpembida',
'description' => 'Pemdaftaran pembida di cawangan'
]);
Permission::create([
'name' => 'jananotis',
'description' => 'Jana Notis Lelong'
]);
//jurulelong
Permission::create(['name' => 'pendaftaranbatch']);
Permission::create(['name' => 'kemaskinihargaasas']);
Permission::create(['name' => 'import']);
Permission::create(['name' => 'lelongan']);
Permission::create(['name' => 'janapemenang']);
Permission::create([
'name' => 'pendaftaranbatch',
'description' => 'Daftar batch lelong'
]);
Permission::create([
'name' => 'kemaskinihargaasas',
'description' => 'Kemaskini harga asas mengikut harga emas semasa'
]);
Permission::create([
'name' => 'import',
'description' => 'Import senarai marhun cawangan to LIVE'
]);
Permission::create([
'name' => 'lelongan',
'description' => '(online/offline) lelong mengikut cawangan'
]);
Permission::create([
'name' => 'janapemenang',
'description' => 'Pemilihan pemenang bagi bidaan paling tinggi'
]);
//operasi
//Permission::create(['name' => 'pendaftaranbatch']); di jurulelong dah ada
Permission::create(['name' => 'report']);
Permission::create(['name' => 'tangguhan']);
Permission::create([
'name' => 'report',
'description' => 'Full report lelongan'
]);
Permission::create([
'name' => 'tangguhan',
'description' => 'Tangguh lelong'
]);
//account
Permission::create(['name' => 'pengesahanbayaran']);
Permission::create([
'name' => 'pengesahanbayaran',
'description' => 'Pengesahan pembayaran pembida dalam akaun yang dibuat melalui (cdm,fpx)'
]);
//pembida
// Permission::create(['name' => 'pendaftaranpembida']); di pc dah ada
Permission::create(['name' => 'bidaan']);
Permission::create(['name' => 'pembayaran']);
Permission::create([
'name' => 'bidaan',
'description' => 'Pendaftaran bagi yang belum mempunyai akaun di cawangan ataupun kata laluan atas talian'
]);
Permission::create([
'name' => 'pembayaran',
'description' => 'Pembayaran pemenang'
]);
// create roles and assign existing permissions
$role1 = Role::create(['name' => 'admin']);
@@ -92,56 +151,56 @@ class RolesSeeder extends Seeder
// create demo users
$user = \App\Models\User::factory()->create([
'nama' => 'Admin',
'name' => 'Admin',
'username' => 'Admin',
'email' => 'admin@example.com',
]);
$user->assignRole($role1);
$user = \App\Models\User::factory()->create([
'nama' => 'Khazanah',
'name' => 'Khazanah',
'username' => 'Khazanah',
'email' => 'khazanah@example.com',
]);
$user->assignRole($role2);
$user = \App\Models\User::factory()->create([
'nama' => 'Teller',
'name' => 'Teller',
'username' => 'Teller',
'email' => 'teller@example.com',
]);
$user->assignRole($role3);
$user = \App\Models\User::factory()->create([
'nama' => 'Pengurus Cawangan',
'name' => 'Pengurus Cawangan',
'username' => 'PC',
'email' => 'penguruscawangan@example.com',
]);
$user->assignRole($role4);
$user = \App\Models\User::factory()->create([
'nama' => 'Juru Lelong',
'name' => 'Juru Lelong',
'username' => 'Juru Lelong',
'email' => 'jurulelong@example.com',
]);
$user->assignRole($role5);
$user = \App\Models\User::factory()->create([
'nama' => 'Operasi',
'name' => 'Operasi',
'username' => 'Operasi',
'email' => 'operasi@example.com',
]);
$user->assignRole($role6);
$user = \App\Models\User::factory()->create([
'nama' => 'Account',
'name' => 'Account',
'username' => 'Account',
'email' => 'account@example.com',
]);
$user->assignRole($role7);
$user = \App\Models\User::factory()->create([
'nama' => 'Pembida',
'name' => 'Pembida',
'username' => 'Pembida',
'email' => 'pembida@example.com',
]);
+1 -1
View File
@@ -20,7 +20,7 @@
</li> -->
</ul>
<div class="group">
<button type="button" class="btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> {{ Auth::user()->nama }} </button>
<button type="button" class="btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> {{ Auth::user()->name }} </button>
<div class="dropdown-menu dropdown-menu-right mr-2">
<button class="dropdown-item" type="button"><i class="fa fa-user"></i> Profile</button>
{{-- logout --}}
+2 -2
View File
@@ -4,10 +4,10 @@
@endphp
<nav id="sidebar" style="">
<div class="sidebar-header">
<h3>Sistem Lelong</h3>
<h3>AOS</h3>
</div>
<ul class="list-unstyled components">
<p>Dummy Heading</p>
<p>Auction Online System</p>
<li class="{{ (request()->is('home')) ? 'active' : '' }}">
<a href="{{url('/home')}}">Home </a>
</li>
+54
View File
@@ -0,0 +1,54 @@
<style>
.page-break {
page-break-after: always;
}
#role {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
font-size: 10px;
}
#role td,
#role th {
border: 1px solid #ddd;
padding: 3px;
font-size: 9px;
text-align: center;
}
#role tr:nth-child(even) {
background-color: #ffffff;
}
#role tr:hover {
background-color: #ddd;
}
#role th {
padding-top: 12px;
padding-bottom: 12px;
text-align: center;
background-color: #d9deda;
color: black;
padding: 2px;
}
</style>
<body>
<h1>Roles</h1>
<table style="margin-bottom:10px;" id="role">
<tr>
<th>BIL</th>
<th>Roles</th>
</tr>
@foreach ($data as $key=>$value)
<tr>
<td>{{$key+1}}</td>
<td>{{ $value->name }}</td>
</tr>
@endforeach
</table>
</body>
+66
View File
@@ -0,0 +1,66 @@
<style>
.page-break {
page-break-after: always;
}
#pengguna {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
font-size: 10px;
}
#pengguna td,
#pengguna th {
border: 1px solid #ddd;
padding: 3px;
font-size: 9px;
text-align: center;
}
#pengguna tr:nth-child(even) {
background-color: #ffffff;
}
#pengguna tr:hover {
background-color: #ddd;
}
#pengguna th {
padding-top: 12px;
padding-bottom: 12px;
text-align: center;
background-color: #d9deda;
color: black;
padding: 2px;
}
</style>
<body>
<h1>Pengguna</h1>
<table style="margin-bottom:10px;" id="pengguna">
<tr>
<th>BIL</th>
<th>Nama</th>
<th>Emails</th>
<th>Taraf</th>
<th>Status</th>
</tr>
@foreach ($data as $key=>$value)
<tr>
<td>{{$key+1}}</td>
<td>{{ $value->name }}</td>
<td>{{ $value->email }}</td>
<td>
@foreach ($value->roles as $taraf)
<p>{{$taraf->name}}</p>
@endforeach
</td>
<td>
{{$value->status}}
</td>
</tr>
@endforeach
</table>
</body>
+54
View File
@@ -0,0 +1,54 @@
<style>
.page-break {
page-break-after: always;
}
#role {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
font-size: 10px;
}
#role td,
#role th {
border: 1px solid #ddd;
padding: 3px;
font-size: 9px;
text-align: center;
}
#role tr:nth-child(even) {
background-color: #ffffff;
}
#role tr:hover {
background-color: #ddd;
}
#role th {
padding-top: 12px;
padding-bottom: 12px;
text-align: center;
background-color: #d9deda;
color: black;
padding: 2px;
}
</style>
<body>
<h1>Roles</h1>
<table style="margin-bottom:10px;" id="role">
<tr>
<th>BIL</th>
<th>Roles</th>
</tr>
@foreach ($data as $key=>$value)
<tr>
<td>{{$key+1}}</td>
<td>{{ $value->name }}</td>
</tr>
@endforeach
</table>
</body>
+61
View File
@@ -0,0 +1,61 @@
<style>
.page-break {
page-break-after: always;
}
#taraf {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
font-size: 10px;
}
#taraf td,
#taraf th {
border: 1px solid #ddd;
padding: 3px;
font-size: 9px;
text-align: center;
}
#taraf tr:nth-child(even) {
background-color: #ffffff;
}
#taraf tr:hover {
background-color: #ddd;
}
#taraf th {
padding-top: 12px;
padding-bottom: 12px;
text-align: center;
background-color: #d9deda;
color: black;
padding: 2px;
}
</style>
<body>
<h1>Taraf</h1>
<table style="margin-bottom:10px;" id="taraf">
<tr>
<th>BIL</th>
<th>TARAF</th>
<th>ROLES</th>
</tr>
@foreach ($data as $key=>$value)
<tr>
<td>{{$key+1}}</td>
<td>{{ $value->name }}</td>
{{-- <td>{{ $role->email }}</td> --}}
<td>
@foreach ($value->permissions->pluck('name') as $taraf)
<p>{{$taraf}}</p>
@endforeach
</td>
</tr>
@endforeach
</table>
</body>
-1
View File
@@ -1 +0,0 @@
<h1>Test</h1>
@@ -13,51 +13,54 @@
<?php
$totaluser = count($alluser);
?>
<table class="table table-striped table-xl" id="pengguna" style="width:100%">
<thead class="bg-primary text-white">
<tr>
<th><input type="checkbox" aria-label="Checkbox for following text input" onclick="selectall(this)"></th>
<th>Nama</th>
<th>Emails</th>
<th>Taraf</th>
<th>Status</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<form id="exportform" action="{{route('pengguna.export')}}" method="POST">
<input type="hidden" name="type" value="User">
<table class="table table-striped table-xl" id="pengguna" style="width:100%">
<thead class="bg-primary text-white">
<tr>
<th><input type="checkbox" aria-label="Checkbox for following text input" onclick="selectall(this)"></th>
<th>Nama</th>
<th>Emails</th>
<th>Taraf</th>
<th>Status</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
@foreach ($alluser as $user)
<tr>
<td><input type="checkbox" aria-label="Checkbox for following text input" name="checkboxdata"></td>
<td>{{ $user->nama }}</td>
<td>{{ $user->email }}</td>
<td>
@foreach ($user->roles as $taraf)
<button class="btn btn-primary btn-sm hovernone" >{{$taraf->name}}</button>
@foreach ($alluser as $user)
<tr>
<td><input type="checkbox" aria-label="Checkbox for following text input" name="checkboxdata[]" value="{{ $user->id }}"></td>
<td>{{ $user->name }}</td>
<td>{{ $user->email }}</td>
<td>
@foreach ($user->roles as $taraf)
<button class="btn btn-primary btn-sm hovernone" >{{$taraf->name}}</button>
@endforeach
</td>
<td>
@if ($user->status =='active')
<button class="btn btn-success btn-sm hovernone-success" >{{$user->status}}</button>
@elseif ($user->status =='banned')
<button class="btn btn-danger btn-sm hovernone-danger" >{{$user->status}}</button>
@endif
</td>
<td class="text-center">
<form action="{{ route('pengguna.delete',$user->id) }}" method="POST" id="formdelpengguna-{{$user->id}}">
@csrf
{{-- <input type="userid" value="{{$user->id}}"> --}}
<a href="{{ route('pengguna.show',$user->id) }}"><i class="far fa-edit"></i></a>
<a href="{{ route('pengguna.show',$user->id) }}"><i class="far fa-eye"></i></a>
<a onclick="confirm({{$user->id}})"><i class="far fa-trash-alt"></i></a>
</form>
</td>
</tr>
@endforeach
</td>
<td>
@if ($user->status =='active')
<button class="btn btn-success btn-sm hovernone-success" >{{$user->status}}</button>
@elseif ($user->status =='banned')
<button class="btn btn-danger btn-sm hovernone-danger" >{{$user->status}}</button>
@endif
</tbody>
</td>
<td class="text-center">
<form action="{{ route('pengguna.delete',$user->id) }}" method="POST" id="formdelpengguna-{{$user->id}}">
@csrf
{{-- <input type="userid" value="{{$user->id}}"> --}}
<a href="{{ route('pengguna.show',$user->id) }}"><i class="far fa-edit"></i></a>
<a href="{{ route('pengguna.show',$user->id) }}"><i class="far fa-eye"></i></a>
<a onclick="confirm({{$user->id}})"><i class="far fa-trash-alt"></i></a>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</table>
</form>
</div>
</div>
@@ -119,7 +122,7 @@
titleAttr: 'Export to CSV',
text: '<i class="fas fa-download"></i>',
action: function ( e, dt, node, config ) {
alert( 'Button activated' );
$("#exportform").submit();
}
}
]
@@ -3,42 +3,45 @@
@section('content')
<div class="container-fluid">
<div class="row">
<div class="col-md-5 mx-auto card p-4">
<div class="col-md-11 mx-auto card p-4">
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
<form id="exportform" action="{{route('pengguna.export')}}" method="POST">
<input type="hidden" name="type" value="Permission">
<table class="table table-striped" id="roles">
<thead class="bg-primary text-white">
<tr>
<th><input type="checkbox" aria-label="Checkbox for following text input" onclick="selectall(this)"></th>
<th>Roles</th>
<th>Keterangan</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
@foreach ($allpermission as $role)
<tr>
<td><input type="checkbox" aria-label="Checkbox for following text input" id="checkboxdata[]" value="{{ $role->id }}"></td>
<td>{{ $role->name }}</td>
<td>{{ $role->description }}</td>
<td class="text-center">
<form action="{{ route('pengguna.deleterole',$role->id) }}" method="POST" id="formdelrole-{{$role->id}}">
@csrf
<a href="{{ route('pengguna.showrole',$role->id) }}"><i class="far fa-edit"></i></a>
<a href="{{ route('pengguna.showrole',$role->id) }}"><i class="far fa-eye"></i></a>
<a onclick="confirm({{$role->id}})"><i class="far fa-trash-alt"></i></a>
</form>
{{-- <a class="btn btn-info" href="{{ route('pengguna.showtaraf',$role->id) }}">Edit</a> --}}
<table class="table table-striped" id="roles">
<thead class="bg-primary text-white">
<tr>
<th><input type="checkbox" aria-label="Checkbox for following text input" onclick="selectall(this)"></th>
<th>Roles</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
@foreach ($allpermission as $role)
<tr>
<td><input type="checkbox" aria-label="Checkbox for following text input" id="checkboxdata"></td>
<td>{{ $role->name }}
</td>
<td class="text-center">
<form action="{{ route('pengguna.deleterole',$role->id) }}" method="POST" id="formdelrole-{{$role->id}}">
@csrf
<a href="{{ route('pengguna.showtaraf',$role->id) }}"><i class="far fa-edit"></i></a>
<a href="{{ route('pengguna.showtaraf',$role->id) }}"><i class="far fa-eye"></i></a>
<a onclick="confirm({{$role->id}})"><i class="far fa-trash-alt"></i></a>
</form>
{{-- <a class="btn btn-info" href="{{ route('pengguna.showtaraf',$role->id) }}">Edit</a> --}}
</td>
</tr>
@endforeach
</tbody>
</td>
</tr>
@endforeach
</tbody>
</table>
</table>
</form>
</div>
</div>
@@ -96,7 +99,7 @@
titleAttr: 'Export to CSV',
text: '<i class="fas fa-download"></i>',
action: function ( e, dt, node, config ) {
alert( 'Button activated' );
$("#exportform").submit();
}
}
]
@@ -14,7 +14,7 @@
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputEmail4">Nama</label>
<input type="text" value="{{$user->nama}}" class="form-control" name="nama" id="inputText" readonly>
<input type="text" value="{{$user->name}}" class="form-control" name="name" id="inputText" readonly>
</div>
<div class="form-group col-md-6">
<label for="inputPassword4">E-mel</label>
@@ -35,7 +35,8 @@
</div>
<div class="text-right pt-4">
<input type="hidden" name="userid" value="{{$user->id}}">
<button type="button" class="btn btn-primary" onclick="confirm()">Simpan</button>
<a href="{{url('pengguna/listpengguna')}}" class="btn btn-primary">Kembali</a>
<button type="button" class="btn btn-warning" onclick="confirm()">Simpan</button>
</div>
</form>
@@ -0,0 +1,57 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
<form action="{{ route('pengguna.storerole') }}" method="POST" id="formrole">
@csrf
<div class="form-row">
<div class="form-group col-md-6">
<label for="rolename">Role</label>
<input type="text" value="{{$permission->name}}" class="form-control" name="name" id="rolename" readonly>
</div>
</div>
<div class="form-row">
<label for="keterangan">Keterangan</label>
<textarea class="form-control" id="keterangan" rows="3" readonly>{{$permission->description}}</textarea>
</div>
<div class="text-right pt-4">
<input type="hidden" name="idrole" value="{{$permission->id}}">
<a href="{{url('pengguna/roles')}}" class="btn btn-primary">Kembali</a>
<button type="button" class="btn btn-warning" onclick="confirm()">Simpan</button>
</div>
</form>
</div>
</div>
</div>
<script>
function confirm() {
$.confirm({
title: 'Confirmation',
content: 'Anda pasti?',
type: 'orange',
typeAnimated: true,
buttons: {
Simpan: {
btnClass: 'btn-warning',
action: function () {
$("#formrole").submit();
}
},
Batal: {
btnClass: 'btn-default',
action: function () {}
}
}
});
}
</script>
@endsection
@@ -9,12 +9,12 @@
<p>{{ $message }}</p>
</div>
@endif
<form action="{{ route('pengguna.storetaraf') }}" method="POST">
<form action="{{ route('pengguna.storetaraf') }}" method="POST" id="formtaraf">
@csrf
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputEmail4">Nama Taraf</label>
<input type="text" value="{{$selectedroles}}" class="form-control" name="nama" id="inputText" readonly>
<input type="text" value="{{$selectedroles}}" class="form-control" name="name" id="inputText" readonly>
</div>
</div>
<div class="form-row">
@@ -31,12 +31,35 @@
</div>
<div class="text-right pt-4">
<input type="hidden" name="namataraf" value="{{$selectedroles}}">
<button type="submit" class="btn btn-primary">Simpan</button>
<a href="{{url('pengguna/taraf')}}" class="btn btn-primary">Kembali</a>
<button type="button" class="btn btn-warning" onclick="confirm()">Simpan</button>
</div>
</form>
</div>
</div>
</div>
<script>
function confirm() {
$.confirm({
title: 'Confirmation',
content: 'Anda pasti?',
type: 'orange',
typeAnimated: true,
buttons: {
Simpan: {
btnClass: 'btn-warning',
action: function () {
$("#formtaraf").submit();
}
},
Batal: {
btnClass: 'btn-default',
action: function () {}
}
}
});
}
</script>
@endsection
@@ -10,6 +10,7 @@
</div>
@endif
<form id="exportform" action="{{route('pengguna.export')}}" method="POST">
<input type="hidden" name="type" value="Role">
<table class="table table-striped" id="taraf">
<thead class="bg-primary text-white">
<tr>
+2 -2
View File
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<title>AOS</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap" rel="stylesheet">
@@ -26,7 +26,7 @@
<div class="container p-5 shadow-lg bg-login-text">
<div class="row">
<div class="col-md-6 d-flex flex-column justify-content-center align-items-center border-right">
<h1 class="text-light"><i class="fa fa-fw fa-gavel"></i>Sistem Lelong</h1>
<h1 class="text-light"><i class="fa fa-fw fa-gavel"></i>Auction Online System</h1>
<p class="pb-4 text-light" style="">Bida Harga Lelong Emas Anda Sekarang Secara Atas Talian</p>
</div>
<div class="col-md-6 flex-column active show p-5 border-left">
+3 -1
View File
@@ -34,10 +34,12 @@ Route::group(['middleware' => ['permission:pengguna'],'prefix'=>'pengguna'], fun
Route::get('/taraf',['as'=>'pengguna.taraf','uses'=>'PenggunaController@taraf']);
Route::get('/taraf/{tarafid}',['as'=>'pengguna.showtaraf','uses'=>'PenggunaController@showtaraf']);
Route::post('/storetaraf',['as'=>'pengguna.storetaraf','uses'=>'PenggunaController@storetaraf']);
Route::post('/deletetaraf/{roleid}',['as'=>'pengguna.deletetaraf','uses'=>'PenggunaController@deletetaraf']);
Route::post('/deletetaraf/{tarafid}',['as'=>'pengguna.deletetaraf','uses'=>'PenggunaController@deletetaraf']);
// Route::get('/roles','PenggunaController@roles');
Route::get('/roles',['as'=>'pengguna.roles','uses'=>'PenggunaController@roles']);
Route::get('/roles/{roleid}',['as'=>'pengguna.showrole','uses'=>'PenggunaController@showrole']);
Route::post('/storerole',['as'=>'pengguna.storerole','uses'=>'PenggunaController@storerole']);
Route::post('/deleterole/{roleid}',['as'=>'pengguna.deleterole','uses'=>'PenggunaController@deleterole']);
Route::post('/export',['as'=>'pengguna.export','uses'=>'PenggunaController@export']);