Merge branch 'main' into amirah

This commit is contained in:
Amirah22
2022-02-09 15:48:15 +08:00
25 changed files with 2154 additions and 68 deletions
+201
View File
@@ -26,7 +26,16 @@ use App\Models\LelongBid;
use App\Models\LelongBidMarhun;
use App\Models\LelKarat;
use App\Models\LelKarat_temp;
use App\Models\Resit;
use App\Models\Payment;
use Session;
use Carbon\Carbon;
use Money\Money;
use Billplz\Client;
use Http\Client\Common\HttpMethodsClient;
use Http\Adapter\Guzzle7\Client as GuzzleHttpClient;
use Http\Message\MessageFactory\GuzzleMessageFactory;
class ApiController extends Controller
{
@@ -41,6 +50,19 @@ class ApiController extends Controller
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function __construct(){
// parent::__construct();
if(config('app.env') != 'production'){
$this->api_key = 'abecfd0c-98d8-4635-abc2-2fcba8c60c11';
$this->XSignature_Key = 'S-GWr7z03XjAhqPsFfu_H5nQ';
$this->collection_id = 'bwdtejv0';
}else{
$this->api_key = 'f3e82fe1-a422-4660-97f0-65cc59ff6c47';
$this->XSignature_Key = 'S-alZUbzmD2_TF3vmrRqgehQ';
}
}
public function biditem()
{
@@ -101,6 +123,185 @@ class ApiController extends Controller
], 401);
}
}
public function feepayment(Request $request)
{
$arraycollection_id = array();
$http = new HttpMethodsClient(
new GuzzleHttpClient(),
new GuzzleMessageFactory()
);
$billplz = new Client($http, $this->api_key);
if(config('app.env') != 'production'){
$billplz->useSandbox();
}
$billplz->useVersion('v4');
$bill = $billplz->bill();
$current = Carbon::now();
$current = new Carbon();
$day = $current->day;
$month = $current->month;
$year = $current->format('y');
$total_bayaran = 1000;
$collection_id = $this->collection_id;
$response = $bill->create(
$collection_id,
'test@gmail.com',
$request->notel,
$request->name,
Money::MYR($total_bayaran),
route('pay.callback'),
'Bayaran Borang',
['redirect_url' => 'http://192.168.0.10:8003/api/pembayaran/response']
);
$previous_siri = Resit::orderBy('id','desc')->first();
if($previous_siri){
$nosiri = $previous_siri->id + 1;
}else{
$nosiri = 1;
}
$billcode = $response->toArray();
// dd($billcode);
// $billcode['redirect_url'] = 'http://192.168.0.10:8003/api/pembayaran/response';
// dd($billcode);
$reference_no = 'LPKB' . $day . $month . $year . sprintf("%08d", $nosiri);
// $response2 = $bill->get($billcode['id']);
// dd($response2->toArray());
$resit = new Resit;
$resit->user_id = $request->user_id;
$resit->lelongbid_id = null;
$resit->reference_no = $reference_no;
$resit->billplz_id = $billcode['id'];
$resit->resit_type = 1;
$resit->total_payment = 10;
$resit->save();
// foreach($array_payment as $index1=>$arraypay)
// {
// $previous_siri = Http::get(config('api.url') . '/api/online/transaction')->json();
// if($previous_siri){
// $nosiri = $previous_siri['nosiri'] + 1;
// }else{
// $nosiri = 1;
// }
// $reference_no = 'LPKB' . $day . $month . $year . sprintf("%08d", $nosiri);
// $new_transaction = Http::post(config('api.url') . '/api/online/transaction',[
// 'nokp'=> Auth::user()->icno,
// 'reference_no'=> $reference_no,
// 'nosiri'=> $nosiri,
// 'billplz_id' => $billcode['id'],
// 'norujukan' => $arraypay['norujukan'],
// 'kodcaw' => $arraypay['kodcaw'],
// 'total_payment'=> $arraypay['bayaran'],
// 'customer_name' => Auth::user()->name,
// ])->json();
// }
return redirect($billcode['url'] . '?auto_submit=true');
// return view('pembayaran.result.berjaya',compact('arraybayaran'));
}
public function callback(Request $request){
dd('hye');
$http = new HttpMethodsClient(
new GuzzleHttpClient(),
new GuzzleMessageFactory()
);
$billplz = new Client($http, $this->api_key);
if(config('app.env') != 'production'){
$billplz->useSandbox();
}
$billplz->useVersion('v4');
$bill = $billplz->bill();
$data = $bill->webhook($request->toArray());
if($data['billplz']['paid'] == 'true'){
$resit = Resit::where('billplz_id','=',$data['billplz']['id'])->first();
$resit->status = 'PAID';
$resit->paid_at = $data['billplz']['paid_at'];
$resit->save();
// $transactionOnline = Http::get(config('api.url') . '/api/transaction/online/express',[
// 'billplz_id' => $data['billplz']['id']
// ])->json();
return response()->json([
'success' => true,
'resit' => $resit
]);
}else{
$resit = Resit::where('billplz_id','=',$data['billplz']['id'])->first();
$resit->status = 'UNSUCCESSFUL';
$resit->paid_at = null;
$resit->save();
return response()->json([
'success' => false,
'resit' => $resit
]);
}
}
public function response(Request $request){
// dd($request->all());
$http = new HttpMethodsClient(
new GuzzleHttpClient(),
new GuzzleMessageFactory()
);
$billplz = new Client($http, $this->api_key);
if(config('app.env') != 'production'){
$billplz->useSandbox();
}
$billplz->useVersion('v4');
$bill = $billplz->bill();
$req = $request->toArray();
$response = $bill->get($req['billplz']['id']);
$data = $response->toArray();
// dd($data);
if($data['paid'] == 'true'){
$resit = Resit::where('billplz_id','=',$data['id'])->first();
$resit->status = 'PAID';
$resit->paid_at = $data['paid_at'];
$resit->save();
// $transactionOnline = Http::get(config('api.url') . '/api/transaction/online/express',[
// 'billplz_id' => $data['billplz']['id']
// ])->json();
return response()->json([
'success' => true,
'resit' => $resit
]);
}else{
$resit = Resit::where('billplz_id','=',$data['id'])->first();
$resit->status = 'UNSUCCESSFUL';
$resit->paid_at = null;
$resit->save();
return response()->json([
'success' => false,
'resit' => $resit
]);
}
}
}
@@ -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([
@@ -1,17 +0,0 @@
<?php
namespace App\Http\Controllers\AuthMobile;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class LelongController extends Controller
{
public function listLelongDetails(Request $request){
$gettlelong = batchlelongonline::on('mysql7')
->where('t_lelong','=',$t_lelong)
->first();
}
}
@@ -0,0 +1,152 @@
<?php
namespace App\Http\Controllers\AuthMobile;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Lelong;
use App\Models\LelongBid;
use App\Models\LelongBidder;
use App\Models\LelongBidMarhun;
use App\Models\lelkarat;
use App\Models\User;
use App\Models\Payment;
use App\Models\Cart;
use Carbon\Carbon;
use App\Models\Cawangan;
class LelongMobileController extends Controller
{
public function getlelongdetails(Request $request){
$currentdate = Carbon::now();
$currentdate = $currentdate->toDateString();
// $arrayLelong = [];
$lelong = Lelong::where('tarikh_lelong','=',$currentdate)->where('sts_lelong','=',1)->get()->toArray();
foreach($lelong as $index1=>$lel)
{
$lelongbid = LelongBid::whereIn('lelong_id',$lelong)
->get()->toArray();
$lelong[$index1]['lelongbid'] = $lelongbid;
foreach($lelongbid as $index2=>$lelbidmarhun){
$cawangan = Cawangan::where('id','=',$lelbidmarhun['caw_id'])->first()->toArray();
// $id = lelongbid::first();
$lelongbidmarhun = LelongBidMarhun::where('lelongbid_id', $lelbidmarhun['id'])
->get()->toArray();
$lelong[$index1]['lelongbid'][$index2]['lelongbidmarhun'] = $lelongbidmarhun;
$lelong[$index1]['lelongbid'][$index2]['cawangan'] = $cawangan;
}
}
return response()->json($lelong);
}
public function getListKarat(Request $request){
$getKarat = lelkarat::all();
// $lelongBidder = lelongBidder::all();
return response()->json($getKarat);
}
public function bidderSelectBidItem(Request $request){
$feepayment = Payment::where('status', '=', 1)->first();
if($feepayment != null){
$user = User::where('id', '=', $request->user_id)
->first();
$selectBid = Cart::join('lelongbid', 'carts.lelongbid_id', '=', 'lelongbid.id')
->where('lelongbid.norujukan', $request->norujukan)
->select('lelongbid.id as lelongbid_id',
'lelongbid.t_lelong',
'lelongbid.nilaimarhun',
'lelongbid.cajlelong',
'carts.hargabida')
->get();
// dd($selectBid[0]->hargabida);
$currentdate = Carbon::now()->toDateTimeString();
$lelongBidder = new LelongBidder();
$lelongBidder->nama_bidder = $request->name;
$lelongBidder->user_id = $user->id;
$lelongBidder->notelbimbit = $user->notelbimbit;
$lelongBidder->hargabida = $selectBid[0]->hargabida;
$lelongBidder->lelongbid_id = $selectBid[0]->lelongbid_id;
$lelongBidder->nilaimarhun = $selectBid[0]->nilaimarhun;
$lelongBidder->cajlelong = $selectBid[0]->cajlelong;
$lelongBidder->masa_bidaan = $currentdate;
$lelongBidder->save();
return response()->json("success", 201);
}
else if($feepayment == null){
return response()->json("unsuccess", 201);
}
}
public function listBidItem(Request $request){
$lelongbidder = LelongBidder::where('user_id','=', $request->user_id)
->get()->toArray();
foreach($lelongbidder as $index1=>$lelbid)
{
$lelongbid = LelongBid::whereIn('id',$lelongbidder)
->get()->toArray();
$lelongbidder[$index1]['lelongbid'] = $lelongbid;
}
return response()->json($lelongbidder);
}
public function searchLelByCaw(Request $request){
$currentdate = Carbon::now();
$currentdate = $currentdate->toDateString();
// $arrayLelong = [];
$lelong = Lelong::join('cawangan_lelong', 'lelong.id', '=', 'cawangan_lelong.lelong_id')
->where('tarikh_lelong','=',$currentdate)
->where('caw_id', '=', $request->caw_id)
->get()->toArray();
foreach($lelong as $index1=>$lel)
{
$lelongbid = LelongBid::where('lelong_id',$lel['lelong_id'])
->get()->toArray();
$lelong[$index1]['lelongbid'] = $lelongbid;
foreach($lelongbid as $index2=>$lelbidmarhun){
$cawangan = Cawangan::where('id','=',$lelbidmarhun['caw_id'])->first()->toArray();
// $id = lelongbid::first();
$lelongbidmarhun = LelongBidMarhun::where('lelongbid_id', $lelbidmarhun['id'])
->get()->toArray();
$lelong[$index1]['lelongbid'][$index2]['lelongbidmarhun'] = $lelongbidmarhun;
$lelong[$index1]['lelongbid'][$index2]['cawangan'] = $cawangan;
}
}
return response()->json($lelong);
}
}
@@ -1,6 +1,6 @@
<?php
namespace App\Http\Controllers\Api;
namespace App\Http\Controllers\AuthMobile;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
@@ -0,0 +1,13 @@
<?php
namespace App\Http\Controllers\AuthMobile;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Lelong;
use App\Models\Users;
class PaymentController extends Controller
{
//
}
@@ -34,8 +34,7 @@ class UserController extends Controller
return response($validator->errors(), 201);
}
$currentdate = Carbon::now();
$currentdate = $currentdate->toDateString();
$currentdate = Carbon::now()->toDateTimeString();
$user_update = User::where('nokp','=',$request->nokp)
->update([
+12 -32
View File
@@ -36,31 +36,21 @@ class CartController extends Controller
public function getCart($userid)
{
$carts = Cart::where('user_id','=', $userid)->get();
$carts = Cart::where('user_id','=', $userid)->get()->toArray();
foreach($carts as $cart)
foreach($carts as $index => $cart)
{
$arraycart = [];
$lelongbid = LelongBid::where('id',$cart->lelongbid_id)->first();
$marhun = LelongBidMarhun::where('lelongbid_id','=',$lelongbid->id)->get();
$lelongbid->marhun = $marhun;
$cart->lelongbid = $lelongbid;
$lelongbid = LelongBid::where('id',$cart['lelongbid_id'])->first()->toArray();
$marhun = LelongBidMarhun::where('lelongbid_id','=',$lelongbid['id'])->get()->toArray();
$cawangan = Cawangan::where('id','=',$lelongbid['caw_id'])->first()->toArray();
$carts[$index]['datalelongbid'] = $lelongbid;
$carts[$index]['datalelongbid']['lelongbidmarhun'] = $marhun;
$carts[$index]['datalelongbid']['cawangan'] = $cawangan;
}
if(sizeof($carts)!=0)
{
return response()->json([
'success' => true,
'carts' => $carts
]);
}
else
{
return response()->json([
'success' => false,
'message' => 'No Data',
], 401);
}
return response()->json($carts);
}
public function addToCart(Request $request)
@@ -72,19 +62,9 @@ class CartController extends Controller
if($item->save())
{
$carts = Cart::where('user_id','=', $request->user_id)->get();
foreach($carts as $cart)
{
$arraycart = [];
$lelongbid = LelongBid::where('id',$cart->lelongbid_id)->first();
$marhun = LelongBidMarhun::where('lelongbid_id','=',$lelongbid->id)->get();
$lelongbid->marhun = $marhun;
$cart->lelongbid = $lelongbid;
}
return response()->json([
'success' => true,
'carts' => $carts
'carts' => $item
]);
}
else
+24 -2
View File
@@ -28,6 +28,9 @@ use App\Models\LelKarat;
use App\Models\LelKarat_temp;
use Carbon\Carbon;
use Carbon\Carbon;
class LelongController extends Controller
{
/**
@@ -346,9 +349,14 @@ 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->sts_lelong = 1;
$lelong->masamula_lelong = $currenttime;
$lelong->masatamat_lelong = $endtime->toTimeString();
$lelong->sts_lelong = 1; //start lelong
$lelong->save();
return redirect()->route('lelong.senarailelong')
@@ -425,5 +433,19 @@ class LelongController extends Controller
->with('success','Kemaskini Berjaya');
}
public function stop($id)
{
$currentdate = Carbon::now();
$currenttime = $currentdate->toTimeString();
$lelong = Lelong::where('id','=',$id)->first();
$lelong->masatamat_lelong = $currenttime;
$lelong->sts_lelong = 2; //stop lelong
$lelong->save();
return redirect()->route('lelong.senarailelong')
->with('success','Lelongan berhenti');
}
}
@@ -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');
}
}
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class lelongBidder extends Model
{
use HasFactory;
protected $table = 'lelongbidder';
protected $fillable = [
'user_id',
'lelongbid_id',
'nama_bidder',
'hargabida',
'notelbimbit',
'nilaimarhun',
'cajlelong',
'status_bidder',
'status_payment',
'masa_bidaan'
];
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class payment extends Model
{
use HasFactory;
protected $table = 'payment';
protected $fillable = [
'user_id',
'lelongbidder_id',
'lelongbid_id',
'kodcaw',
'total_payment',
'back_acc_pembeli',
'bank_acc_no_pembeli',
'nama_bank_acc_caw',
'bank_no_acc_caw',
'status_payment_opt',
'resit_id',
'status',
'remark'
];
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class resit extends Model
{
use HasFactory;
protected $table = 'resit';
protected $fillable = [
'user_id',
'lelongbid_id',
'reference_no',
'billplz_id',
'total_payment',
'resit_type', // 1 = fee , 2 = bid
'status', //status => 1 = paid , 2 = pending
'paid_at'
];
}
+2
View File
@@ -10,9 +10,11 @@
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"intervention/image": "^2.7",
"jomweb/billplz": "4.1",
"laravel/framework": "^8.65",
"laravel/sanctum": "^2.13",
"laravel/tinker": "^2.5",
"php-http/guzzle7-adapter": "^1.0",
"spatie/laravel-permission": "^5.3"
},
"require-dev": {
Generated
+1150 -1
View File
File diff suppressed because it is too large Load Diff
@@ -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();
@@ -0,0 +1,50 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateLelongbidderTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('lelongbidder', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->unsigned();
$table->unsignedBigInteger('lelongbid_id')->unsigned();
$table->string('nama_bidder');
$table->decimal('hargabida');
$table->string('notelbimbit');
$table->decimal('nilaimarhun');
$table->decimal('cajlelong');
$table->integer('status_bidder')->nullable(); //1 = win
$table->integer('status_payment')->nullable(); // 1=paid
$table->datetime('masa_bidaan');
$table->timestamps();
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
$table->foreign('lelongbid_id')
->references('id')->on('lelongbid')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('lelongbidder');
}
}
@@ -0,0 +1,79 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePaymentTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('payment', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->unsigned();
$table->unsignedBigInteger('lelongbidder_id')->unsigned()->nullable();
$table->unsignedBigInteger('lelongbid_id')->unsigned();
$table->string('kodcaw')->nullable();
$table->decimal('total_payment')->nullable();
$table->string('back_acc_pembeli')->nullable();
$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(); //1=online,2=kaunter
$table->integer('resit_id');
$table->integer('status'); //1 = fee RM10 , 2 = paybidifwin
$table->string('remark');
$table->timestamps();
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
$table->foreign('lelongbid_id')
->references('id')->on('lelongbid')
->onDelete('cascade');
$table->foreign('lelongbidder_id')
->references('id')->on('lelongbidder')
->onDelete('cascade');
});
Schema::create('resit', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->unsigned();
$table->unsignedBigInteger('lelongbid_id')->unsigned()->nullable();
$table->string('reference_no')->nullable();
$table->string('billplz_id');
$table->decimal('total_payment', $precision = 9, $scale = 2);
$table->string('resit_type'); // 1 = fee , 2 = bid
$table->string('status')->nullable(); //status => 1 = paid , 2 = pending
$table->timestamp('paid_at')->nullable();
$table->timestamps();
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
$table->foreign('lelongbid_id')
->references('id')->on('lelongbid')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('payment');
Schema::dropIfExists('resit');
}
}
+8
View File
@@ -160,6 +160,7 @@ class RolesSeeder extends Seeder
'name' => 'Admin',
'username' => 'Admin',
'email' => 'admin@example.com',
'user_type' => 1
]);
$user->assignRole($role1);
@@ -167,6 +168,7 @@ class RolesSeeder extends Seeder
'name' => 'Khazanah',
'username' => 'Khazanah',
'email' => 'khazanah@example.com',
'user_type' => 1
]);
$user->assignRole($role2);
@@ -174,6 +176,7 @@ class RolesSeeder extends Seeder
'name' => 'Teller',
'username' => 'Teller',
'email' => 'teller@example.com',
'user_type' => 1
]);
$user->assignRole($role3);
@@ -181,6 +184,7 @@ class RolesSeeder extends Seeder
'name' => 'Pengurus Cawangan',
'username' => 'PC',
'email' => 'penguruscawangan@example.com',
'user_type' => 1
]);
$user->assignRole($role4);
@@ -188,6 +192,7 @@ class RolesSeeder extends Seeder
'name' => 'Juru Lelong',
'username' => 'Juru Lelong',
'email' => 'jurulelong@example.com',
'user_type' => 1
]);
$user->assignRole($role5);
@@ -195,6 +200,7 @@ class RolesSeeder extends Seeder
'name' => 'Operasi',
'username' => 'Operasi',
'email' => 'operasi@example.com',
'user_type' => 1
]);
$user->assignRole($role6);
@@ -202,6 +208,7 @@ class RolesSeeder extends Seeder
'name' => 'Account',
'username' => 'Account',
'email' => 'account@example.com',
'user_type' => 1
]);
$user->assignRole($role7);
@@ -209,6 +216,7 @@ class RolesSeeder extends Seeder
'name' => 'Pembida',
'username' => 'Pembida',
'email' => 'pembida@example.com',
'user_type' => 2
]);
$user->assignRole($role8);
}
@@ -91,6 +91,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>
<a class="stoplelong" href="{{ route('lelong.stop',$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
<a href="{{ route('lelong.exportnotis',$lel->id) }}"><i class="fas fa-download"></i></a>
@@ -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
+83
View File
@@ -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
+28 -8
View File
@@ -4,8 +4,9 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\AuthMobile\AuthController;
use App\Http\Controllers\AuthMobile\UserController;
use App\Http\Controllers\AuthMobile\LelongMobileController;
use App\Http\Controllers\CartController;
use App\Http\Controllers\AuthMobile\LelongController;
use App\Http\Controllers\ApiController;
/*
|--------------------------------------------------------------------------
@@ -24,21 +25,40 @@ Route::post('/login', [AuthController::class, 'login']);
Route::post('/forgotpassword', [ResetPassword::class, 'forgotpassword']);
Route::post('/addToCart', [CartController::class, 'addToCart']);
Route::get('/cart/{userid}', [CartController::class, 'getCart']);
// Route::post('/feepayment', [ApiController::class, 'feepayment']);
// Route::get('/callback', [ApiController::class, 'feepayment']);
Route::post('/feepayment', [ApiController::class, 'feepayment'])->name('feepayment');
Route::get('/pembayaran/response', [ApiController::class, 'response'])->name('pay.paymentStatus');
Route::get('/pembayaran/backend', [ApiController::class, 'callback'])->name('pay.callback');
//Protected routes
Route::group(['middleware' => ['auth:sanctum']], function () {
// User
Route::post('/logout', [AuthController::class, 'logout']);
Route::get('/user/profile/{nokp}', [UserController::class, 'getProfileUser']);
Route::post('/updateItem', [CartController::class, 'updateItem']);
Route::get('/deleteItem/{id}', [CartController::class, 'deleteCart']);
Route::post('/forgotPassword', [NewPasswordController::class, 'forgotPassword']);
Route::post('/resetPassword', [NewPasswordController::class, 'reset']);
Route::post('/reset', [NewPasswordController::class, 'reset']);
// User Profile
Route::get('/user/profile', [UserController::class, 'getProfileUser']);
Route::put('/userUpdate/profile', [UserController::class, 'updateProfileUser']);
Route::put('/lelong', [LelongController::class, 'listLelongDetails']);
// Cart
Route::post('/updateItem', [CartController::class, 'updateItem']);
Route::get('/deleteItem/{id}', [CartController::class, 'deleteCart']);
// Lelong
Route::get('/lelongDetails/today', [LelongMobileController::class, 'getlelongdetails']);
Route::get('/lelongDetails/cawangan', [LelongMobileController::class, 'searchLelByCaw']);
Route::get('/karat', [LelongMobileController::class, 'getListKarat']);
// Lelong => Bidder
Route::post('/bidder/biditem', [LelongMobileController::class, 'bidderSelectBidItem']);
Route::get('/bidder/listbiditem', [LelongMobileController::class, 'listBidItem']);
});
+13
View File
@@ -1,6 +1,7 @@
<?php
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Http;
/*
|--------------------------------------------------------------------------
@@ -17,6 +18,11 @@ Route::get('/', function () {
return view('welcome');
})->name('login');
Route::get('/test', function () {
$response = Http::get('http://localhost:8000/api/lelongDetails/today')->json();
dd($response);
})->name('test');
Auth::routes();
Route::get('/home','HomeController@index')->name('home');
@@ -109,4 +115,11 @@ Route::group(['middleware' => ['permission:semakanmarhun','permission:kemaskinim
Route::post('/exportmarhun',['as'=>'marhun.exportmarhundetails','uses'=>'MarhunController@exportmarhundetails']);
});
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']);
});