commit
This commit is contained in:
@@ -19,6 +19,7 @@ class AuthController extends Controller
|
||||
'username' => 'required|string|unique:users',
|
||||
'nokp' => 'required|string|unique:users',
|
||||
'password' => 'required|string|min:8',
|
||||
'email' => 'required|string|unique:users|email',
|
||||
'notelbimbit' => 'required|string|unique:users',
|
||||
'register_agree' => 'required|integer'
|
||||
|
||||
@@ -45,6 +46,7 @@ class AuthController extends Controller
|
||||
$user->username = $fields['username'];
|
||||
$user->nokp = $fields['nokp'];
|
||||
$user->password = bcrypt($fields['password']);
|
||||
$user->email = $fields['email'];
|
||||
$user->notelbimbit = $fields['notelbimbit'];
|
||||
$user->register_agree = $fields['register_agree'];
|
||||
$user->t_daftar = $currentdate;
|
||||
@@ -85,7 +87,25 @@ class AuthController extends Controller
|
||||
|
||||
//Check username
|
||||
$user = User::where('username', $fields['username'])->first();
|
||||
|
||||
|
||||
if($user->status != 'active')
|
||||
{
|
||||
if($user->status == 'banned')
|
||||
{
|
||||
return response([
|
||||
'message' => 'User Banned'
|
||||
], 401);
|
||||
}
|
||||
else
|
||||
{
|
||||
return response([
|
||||
'message' => 'Registration in progress,status wait for approval.'
|
||||
], 401);
|
||||
}
|
||||
return response([
|
||||
'message' => 'Bad Creds'
|
||||
], 401);
|
||||
}
|
||||
//Check Password
|
||||
if(!$user || !Hash::check($fields['password'], $user->password)){
|
||||
return response([
|
||||
|
||||
@@ -27,6 +27,9 @@ use App\Models\LelongBidMarhun;
|
||||
use App\Models\LelKarat;
|
||||
use App\Models\LelKarat_temp;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
class LelongController extends Controller
|
||||
{
|
||||
/**
|
||||
@@ -333,8 +336,13 @@ class LelongController extends Controller
|
||||
|
||||
public function start($id)
|
||||
{
|
||||
$currentdate = Carbon::now();
|
||||
$currenttime = $currentdate->toTimeString();
|
||||
$endtime = $currentdate->addHours(2);
|
||||
|
||||
$lelong = Lelong::where('id','=',$id)->first();
|
||||
$lelong->masatamat_lelong = '2021-12-20 04:51:50';
|
||||
$lelong->masamula_lelong = $currenttime;
|
||||
$lelong->masatamat_lelong = $endtime->toTimeString();
|
||||
$lelong->sts_lelong = 1;
|
||||
$lelong->save();
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\User;
|
||||
use App\Models\File;
|
||||
use PDF;
|
||||
use Carbon\Carbon;
|
||||
|
||||
|
||||
class PembidaController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// $alluser = User::all();
|
||||
$alluser = User::doesntHave('roles')->where('user_type','=',2)->get();
|
||||
// $allroles = Role::all()->pluck('name');
|
||||
// $user = Auth::user();
|
||||
// $user->assignRole('admin');
|
||||
return view('pembida.senaraipembida',compact('alluser'));
|
||||
}
|
||||
|
||||
public function show($userid)
|
||||
{
|
||||
// dd($userid);
|
||||
$user = User::where('id','=',$userid)->first();
|
||||
$files = File::where('user_id','=',$userid)->get()->toArray();
|
||||
|
||||
$array_ic = [];
|
||||
foreach($files as $index=>$file)
|
||||
{
|
||||
$files[$index]['ic64']= 'data:image/' . $file['file_type'] . ';base64,' . base64_encode($file['filename']);
|
||||
}
|
||||
|
||||
// dd($files);
|
||||
return view('pembida.show',compact('user','files'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function delete(Request $request)
|
||||
{
|
||||
$user = User::where('id','=',$request->userid)->first();
|
||||
$user->note =$request->note;
|
||||
$user->status = 'Fail';
|
||||
$user->save();
|
||||
|
||||
return redirect()->route('pembida.senaraipembida')
|
||||
->with('success','Padam Pengguna Berjaya');
|
||||
}
|
||||
|
||||
public function sah($userid)
|
||||
{
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateString();
|
||||
|
||||
$user = User::where('id','=',$userid)->first();
|
||||
$user->disahkan_pada = $currentdate;
|
||||
$user->disahkan_oleh = Auth::user()->id;
|
||||
$user->status = 'active';
|
||||
|
||||
if($user->save())
|
||||
{
|
||||
$user->assignRole('pembida');
|
||||
}
|
||||
|
||||
return redirect()->route('pembida.senaraipembida')
|
||||
->with('success','Pengesahan Berjaya');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class CreateUsersTable extends Migration
|
||||
$table->datetime('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->datetime('disahkan_pada')->nullable();
|
||||
$table->datetime('disahkan_oleh')->nullable();
|
||||
$table->integer('disahkan_oleh')->nullable();
|
||||
$table->string('user_type')->nullable(); //set 1,2
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
|
||||
@@ -24,7 +24,7 @@ class CreatePaymentTable extends Migration
|
||||
$table->string('bank_acc_no_pembeli')->nullable();
|
||||
$table->string('nama_bank_acc_caw')->nullable();
|
||||
$table->string('bank_no_acc_caw')->nullable();
|
||||
$table->integer('status_payment_opt')->nullable();
|
||||
$table->integer('status_payment_opt')->nullable(); //1=online,2=kaunter
|
||||
$table->integer('resit_id');
|
||||
$table->integer('status'); //1 = fee RM10 , 2 = paybidifwin
|
||||
$table->string('remark');
|
||||
|
||||
@@ -86,6 +86,9 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="{{ (request()->is('pembida/*')) ? 'active' : '' }}">
|
||||
<a href="{{url('pembida/senaraipembida')}}">Pengesahan Pembida Baharu</a>
|
||||
</li>
|
||||
@endhasrole
|
||||
@hasrole('account')
|
||||
{{-- <li class="{{ (request()->is('home')) ? 'active' : '' }}">
|
||||
|
||||
@@ -36,14 +36,17 @@
|
||||
<td>{{ $lel->cajlelong }}</td>
|
||||
<td class="text-center">
|
||||
@hasrole('jurulelong')
|
||||
<a href="{{ route('lelong.refresh',$lel->id) }}"><i class="fas fa-sync-alt"></i></a>
|
||||
|
||||
@if(!$lel->masatamat_lelong)
|
||||
<a href="{{ route('lelong.refresh',$lel->id) }}"><i class="fas fa-sync-alt"></i></a>
|
||||
<a class="startlelong" href="{{ route('lelong.start',$lel->id) }}"><i class="fa fa-play"></i></a>
|
||||
<a class="confirmdel" href="{{ route('lelong.delete',$lel->id) }}"><i class="far fa-trash-alt"></i></a>
|
||||
@elseif ($lel->sts_lelong == 2)
|
||||
<a href="{{ route('lelong.show',$lel->id) }}"><i class="fas fa-trophy"></i></a>
|
||||
@else
|
||||
<a class="stoplelong" href="{{ route('lelong.start',$lel->id) }}"><i class="fa fa-stop"></i></a>
|
||||
@endif
|
||||
<a href="{{ route('lelong.show',$lel->id) }}"><i class="far fa-edit"></i></a>
|
||||
<a class="confirmdel" href="{{ route('lelong.delete',$lel->id) }}"><i class="far fa-trash-alt"></i></a>
|
||||
@endhasrole
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<div class="row ">
|
||||
<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
|
||||
<?php
|
||||
// $totaluser = count($alluser);
|
||||
?>
|
||||
<form id="exportform" action="{{route('pengguna.export')}}" method="POST">
|
||||
@csrf
|
||||
<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>Number Phone</th>
|
||||
<th>Email</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[]" value="{{ $user->id }}"></td>
|
||||
<td>{{ $user->name }}</td>
|
||||
<td>{{ $user->notelbimbit }}</td>
|
||||
<td>{{ $user->email }}</td>
|
||||
<td>
|
||||
@if ($user->status =='active')
|
||||
<button class="btn btn-success btn-sm hovernone-success" disabled>{{$user->status}}</button>
|
||||
@elseif ($user->status =='banned')
|
||||
<button class="btn btn-danger btn-sm hovernone-danger" disabled>{{$user->status}}</button>
|
||||
@endif
|
||||
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<a href="{{ route('pembida.show',$user->id) }}"><i class="fas fa-check"></i></a>
|
||||
{{-- <a class="confirmdel" href="{{ route('pengguna.delete',$user->id) }}"><i class="far fa-trash-alt"></i></a> --}}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$('a.confirmdel').confirm({
|
||||
title: 'Confirmation',
|
||||
content: 'Anda pasti?',
|
||||
type: 'orange',
|
||||
typeAnimated: true,
|
||||
buttons: {
|
||||
Delete: {
|
||||
btnClass: 'btn-warning',
|
||||
action: function () {
|
||||
location.href = this.$target.attr('href');
|
||||
}
|
||||
},
|
||||
Batal: {
|
||||
btnClass: 'btn-default',
|
||||
action: function () {}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var tablepengguna = $('#pengguna').DataTable( {
|
||||
"columnDefs": [
|
||||
{
|
||||
"targets": 0,
|
||||
"orderable": false
|
||||
},
|
||||
{
|
||||
"targets": 4,
|
||||
"orderable": false
|
||||
}
|
||||
],
|
||||
order: [[1, 'asc']],
|
||||
// "ordering": false,
|
||||
"info": false,
|
||||
"lengthChange": false,
|
||||
"pageLength": 15,
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
// 'copy', 'excel', 'pdf'
|
||||
// { text: 'copy', className: 'btn btn-primary' },
|
||||
{
|
||||
className: 'btn btn-outline-success pl-4 pr-4 btn-sm adduser',
|
||||
text: '<i class="fas fa-plus" id="test"></i>',
|
||||
titleAttr: 'Tambah Pembida',
|
||||
action: function ( e, dt, node, config ) {
|
||||
alert( 'Button activated' );
|
||||
}
|
||||
},
|
||||
{
|
||||
className: 'btn btn-outline-secondary pl-4 pr-4 btn-sm export',
|
||||
titleAttr: 'Export to PDF',
|
||||
text: '<i class="fas fa-download"></i>',
|
||||
action: function ( e, dt, node, config ) {
|
||||
$("#exportform").submit();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
$('.adduser').tooltip();
|
||||
$('.export').tooltip();
|
||||
// $( '.dt-buttons').addClass('btn-group');
|
||||
$( '.adduser').removeClass('dt-button');
|
||||
$( '.export').removeClass('dt-button');
|
||||
|
||||
|
||||
function selectall(cb) {
|
||||
tablepengguna.rows().nodes().to$().find('input[type="checkbox"]').each(function(){
|
||||
$(this).prop('checked', cb.checked);
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
@@ -0,0 +1,83 @@
|
||||
@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('pembida.sah',$user->id) }}" method="GET" id="formpengguna">
|
||||
@csrf
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputEmail4">Nama</label>
|
||||
<input type="text" value="{{$user->name}}" class="form-control" name="name" id="name" readonly>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4">Email</label>
|
||||
<input type="email" value="{{$user->email}}" class="form-control" name="email" id="email" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4">Number Phone</label>
|
||||
<input type="text" value="{{$user->notelbimbit}}" class="form-control" name="notelbimbit" id="notelbimbit" readonly>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4">Identity Card/Passport Number</label>
|
||||
<input type="text" value="{{$user->nokp}}" class="form-control" name="nokp" id="nokp" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<h4 class="col-md-3">Identity Card/Passport Picture</h4>
|
||||
<div class="form-group col-md-9">
|
||||
@foreach ($files as $file)
|
||||
<div class="col-4 form-check form-check-inline">
|
||||
<?php
|
||||
// $picic = imagecreatefromstring($file['ic64']);
|
||||
// header('Content-type: image/'.$file['file_type']);
|
||||
?>
|
||||
<img src="{{$file['ic64']}}" alt="">
|
||||
{{$file['ic64']}}
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right pt-4">
|
||||
<input type="hidden" name="userid" value="{{$user->id}}">
|
||||
<a href="{{url('pembida/senaraipembida')}}" class="btn btn-primary">Kembali</a>
|
||||
<button type="button" class="btn btn-success" onclick="confirm()">Sah</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{{-- <button class="btn btn-primary" onclick="confirm()">Simpan</button> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function confirm() {
|
||||
$.confirm({
|
||||
title: 'Confirmation',
|
||||
content: 'Anda pasti?',
|
||||
type: 'green',
|
||||
typeAnimated: true,
|
||||
buttons: {
|
||||
Sah: {
|
||||
btnClass: 'btn-success',
|
||||
action: function () {
|
||||
$("#formpengguna").submit();
|
||||
}
|
||||
},
|
||||
Batal: {
|
||||
btnClass: 'btn-default',
|
||||
action: function () {}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
@@ -110,4 +110,11 @@ Route::group(['middleware' => ['permission:semakanmarhun','permission:kemaskinim
|
||||
Route::post('/kemaskini',['as'=>'marhun.kemaskini','uses'=>'MarhunController@kemaskini']);
|
||||
Route::get('/semakan',['as'=>'marhun.semakan','uses'=>'MarhunController@semakan']);
|
||||
|
||||
});
|
||||
|
||||
Route::group(['middleware' => ['permission:pengesahanpembida'],'prefix'=>'pembida'], function () {
|
||||
Route::get('/senaraipembida',['as'=>'pembida.senaraipembida','uses'=>'PembidaController@index']);
|
||||
Route::get('/pembida/{id}',['as'=>'pembida.show','uses'=>'PembidaController@show']);
|
||||
Route::get('/deletepembida/{id}',['as'=>'pembida.delete','uses'=>'PembidaController@delete']);
|
||||
Route::get('/sahkanpembida/{id}',['as'=>'pembida.sah','uses'=>'PembidaController@sah']);
|
||||
});
|
||||
Reference in New Issue
Block a user