chess/app/Http/Controllers/OthersController.php
Ramadhon Ikhsan Prasetya 2f08a4c0ce tambah change password
2024-08-29 13:34:58 +07:00

878 lines
39 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Models\BudgetTypeModel;
use App\Models\ClientModel;
use App\Models\CompanyModel;
use App\Models\CriticalLevelModel;
use App\Models\JenisTaskModel;
use App\Models\StatusModel;
use App\Models\TeamRoleModel;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Yajra\DataTables\DataTables;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\QueryException;
use App\User;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Hash;
class OthersController extends Controller
{
//
public function mngTeam(Request $request) {
// $param['table'] = route('others.dataTable')."?type=mngTeam";
$param['urlData'] = route('others.data')."?type=mngTeam";
// return view('home')->nest('child', 'content.others.team.index', $param);
return $this->bsGetView('content.others.team.index', $param);
}
public function company(Request $request) {
$param['table'] = route('others.dataTable')."?type=company";
// return view('home')->nest('child', 'content.others.company.index', $param);
return $this->bsGetView('content.others.company.index', $param);
}
public function company_store(Request $request) {
DB::beginTransaction();
try {
if($request->get_id) {
$company = CompanyModel::find($request->get_id);
$company->user_upd_id = Auth::user()->id;
$company->company_name = $request->company_name;
$company->company_code = $request->company_code;
$company->address = $request->address;
$company->phone_no = $request->phone_no;
$company->email = $request->email;
$company->pic_name = $request->pic_name;
if($request->hasFile('logo_url')){
$destination_path = public_path('gallery');
$image_path = public_path($company->logo_url);
if(File::exists($image_path)) {
File::delete($image_path);
}
$files = $request->file('logo_url');
$filename = 'User_'.date('Ymd')."_".date('His').'.'.$files->getClientOriginalExtension();
$upload_success = $files->move($destination_path, $filename);
$company->logo_url = '/gallery/'.$filename;
}
$company->save();
} else {
$company = new CompanyModel();
// $get_max = DB::table('master_company')->max('id');
// $company->id = $get_max+1;
$company->user_crt_id = Auth::user()->id;
$company->company_name = $request->company_name;
$company->company_code = $request->company_code;
$company->address = $request->address;
$company->phone_no = $request->phone_no;
$company->email = $request->email;
$company->pic_name = $request->pic_name;
if($request->hasFile('logo_url')){
$destination_path = public_path('gallery');
$files = $request->file('logo_url');
$filename = 'LogoC_'.date('Ymd')."_".date('His').'.'.$files->getClientOriginalExtension();
$upload_success = $files->move($destination_path, $filename);
$company->logo_url = '/gallery/'.$filename;
}
// $company->save();
if($company->save()) {
$nameStatus = array('Assigned', 'On Progress', 'Done', 'Inactive');
$noI = 1;
$data = [];
for($i=0; $i<sizeOf($nameStatus); $i++) {
$data[$i] = [
'id' => $noI++,
'definition' => $nameStatus[$i],
'is_active' => true,
'company_id' => $company->id,
];
}
$status = StatusModel::insert($data);
$nameCritical = array('Low', 'Medium', 'High', 'Critical', 'Very Critical');
$bobotCritical = array('0.25', '0.5', '1', '1.25', '1.5');
$noJ = 1;
$dataJ = [];
for($j=0; $j<sizeOf($nameCritical); $j++) {
$dataJ[$j] = [
'id' => $noJ++,
'definition' => $nameCritical[$j],
'is_active' => true,
'company_id' => $company->id,
'bobot' => $bobotCritical[$j],
];
}
$critical = CriticalLevelModel::insert($dataJ);
$arrayBudget = array(
[
'id' => 1,
'definition' => 'BudgetAwal',
'is_shown' => false,
'tx_type' => 'Kr',
'operator' => '+',
'rev_operator' => '-',
'is_active' => true,
'company_id' => $company->id
], [
'id' => 2,
'definition' => 'Transportasi',
'is_shown' => true,
'tx_type' => 'Db',
'operator' => '-',
'rev_operator' => '+',
'is_active' => true,
'company_id' => $company->id
], [
'id' => 3,
'definition' => 'Akomodasi',
'is_shown' => true,
'tx_type' => 'Db',
'operator' => '-',
'rev_operator' => '+',
'is_active' => true,
'company_id' => $company->id
], [
'id' => 4,
'definition' => 'Konsumsi',
'is_shown' => true,
'tx_type' => 'Db',
'operator' => '-',
'rev_operator' => '+',
'is_active' => true,
'company_id' => $company->id
], [
'id' => 5,
'definition' => 'Insentif Perjalanan Dinas',
'is_shown' => true,
'tx_type' => 'Db',
'operator' => '-',
'rev_operator' => '+',
'is_active' => true,
'company_id' => $company->id
], [
'id' => 6,
'definition' => 'Pembelian Inventaris',
'is_shown' => true,
'tx_type' => 'Db',
'operator' => '-',
'rev_operator' => '+',
'is_active' => true,
'company_id' => $company->id
], [
'id' => 7,
'definition' => 'Pembelian Software',
'is_shown' => true,
'tx_type' => 'Db',
'operator' => '-',
'rev_operator' => '+',
'is_active' => true,
'company_id' => $company->id
], [
'id' => 8,
'definition' => 'Penyesuaian Budget',
'is_shown' => true,
'tx_type' => 'Kr',
'operator' => '+',
'rev_operator' => '-',
'is_active' => true,
'company_id' => $company->id
], [
'id' => 9,
'definition' => 'Pengurangan Budget',
'is_shown' => true,
'tx_type' => 'Db',
'operator' => '-',
'rev_operator' => '+',
'is_active' => true,
'company_id' => $company->id
], [
'id' => 10,
'definition' => 'Lainnya',
'is_shown' => true,
'tx_type' => 'Db',
'operator' => '-',
'rev_operator' => '+',
'is_active' => true,
'company_id' => $company->id
]
);
$budget = BudgetTypeModel::insert($arrayBudget);
$nameTeamRole = array('PM', 'Deputi PM', 'Member');
$noK = 1;
$dataK = [];
for($k=0; $k<sizeOf($nameTeamRole); $k++) {
$dataK[$k] = [
'id' => $noK++,
'definition' => $nameTeamRole[$k],
'is_active' => true,
'company_id' => $company->id,
];
}
$team_role = TeamRoleModel::insert($dataK);
// $lastIdTaskType = DB::table('ref_task_type')->max('id');
$arrayTaskType = array(
[
// 'id' => $lastIdTaskType+1,
'definition' => 'Teknologi Informasi',
'is_active' => true,
'company_id' => $company->id,
],
[
// 'id' => $lastIdTaskType+2,
'definition' => 'Bisnis',
'is_active' => true,
'company_id' => $company->id,
],
[
// 'id' => $lastIdTaskType+3,
'definition' => 'Operation',
'is_active' => true,
'company_id' => $company->id,
],
[
// 'id' => $lastIdTaskType+4,
'definition' => 'Satuan Pengendalian Intern',
'is_active' => true,
'company_id' => $company->id,
],
);
JenisTaskModel::insert($arrayTaskType);
$user = new User();
$get_max = DB::table('master_user')->max('id');
// $user->id = $get_max+1;
$codeGenerate = str_pad($get_max+1, 5, 0, STR_PAD_LEFT);
$userCode = 'adm_7'.$company->id.$codeGenerate;
$user->user_crt_id = Auth::user()->id;
$user->password = bcrypt('welcome1');
$user->full_name = 'Administrator '. $company->company_name;
$user->user_code = $userCode;
$user->unit_id = 1;
$user->is_active = true;
$user->is_onholiday = false;
$user->role_id = 6;
$user->company_id = $company->id;
$user->save();
}
}
//code...
DB::commit();
return response()->json([
'rc' => 0,
'rm' => 'sukses'
]);
} catch (\Throwable $e) {
//throw $th;
DB::rollBack();
return response()->json([
'rc' => 99,
'data' => $e->getMessage()
]);
} catch (QueryException $e) {
DB::rollBack();
return response()->json([
'rc' => 500,
'data' => $e->getMessage()
]);
}
}
public function company_get($id) {
$data['data'] = DB::table('master_company')->where('id', $id)->first();
$data['list_user'] = DB::table('master_user')->where('company_id', $id)->get();
return response()->json($data);
}
public function client(Request $request) {
$param['table'] = route('others.dataTable')."?type=client";
// return view('home')->nest('child', 'content.others.client.index', $param);
return $this->bsGetView('content.others.client.index', $param);
}
public function client_store(Request $request) {
DB::beginTransaction();
try {
if($request->get_id) {
$client = ClientModel::find($request->get_id);
} else {
$client = new ClientModel();
}
if($request->hasFile('logo_url')){
// $destination_path = public_path('gallery');
// $image_path = public_path($client->logo_url);
// if(File::exists($image_path)) {
// File::delete($image_path);
// }
$files = $request->file('logo_url');
SpaceController::deleteFile($client->logo_url);
$urlDoc = SpaceController::uploadFile($files, 'client', []);
$client->logo_url = $urlDoc;
// $filename = 'Client_'.date('Ymd')."_".date('His').'.'.$files->getClientOriginalExtension();
// $upload_success = $files->move($destination_path, $filename);
}
$client->client_name = $request->client_name;
$client->address = $request->address;
$client->is_active = $request->is_active;
$client->save();
//code...
DB::commit();
return response()->json([
'rc' => 0,
'rm' => 'sukses'
]);
} catch (\Throwable $e) {
//throw $th;
DB::rollBack();
return response()->json([
'rc' => 99,
'data' => $e->getMessage()
]);
} catch (QueryException $e) {
DB::rollBack();
return response()->json([
'rc' => 500,
'data' => $e->getMessage()
]);
}
}
public function client_get($id) {
$data['data'] = DB::table('master_client')->where('id', $id)->first();
return response()->json($data);
}
public function user(Request $request) {
$param['table'] = route('others.dataTable')."?type=user";
// return view('home')->nest('child', 'content.others.user.index', $param);
return $this->bsGetView('content.others.user.index', $param);
}
public function user_store(Request $request) {
DB::beginTransaction();
try {
if($request->get_id) {
$user = User::find($request->get_id);
$user->user_upd_id = Auth::user()->id;
} else {
$user = new User();
// $get_max = DB::table('master_user')->max('id');
// $user->id = $get_max+1;
$user->user_crt_id = Auth::user()->id;
$user->password = bcrypt('welcome1');
}
$user->email = $request->email;
$user->full_name = $request->full_name;
$user->user_code = $request->user_code;
// $user->unit_id = $request->unit_id;
$user->is_active = $request->is_active;
// $user->is_onholiday = false;
$user->role_id = $request->role_id;
$user->division_id = $request->division_id;
// $user->phone_number = $request->phone_number;
// $user->company_id = Auth::user()->company_id;
if($request->is_external) {
$user->client_id = $request->client_id;
}
if($request->hasFile('foto_profil')){
// $destination_path = public_path('gallery');
// $image_path = public_path($user->image_url);
// if(File::exists($image_path)) {
// File::delete($image_path);
// }
SpaceController::deleteFile($user->image_url);
$files = $request->file('foto_profil');
$urlDoc = SpaceController::uploadFile($files, 'profile', []);
// $filename = 'User_'.date('Ymd')."_".date('His').'.'.$files->getClientOriginalExtension();
// $upload_success = $files->move($destination_path, $filename);
// $user->image_url = '/gallery/'.$filename;
$user->image_url = $urlDoc;
}
$user->save();
//code...
DB::commit();
return response()->json([
'rc' => 0,
'rm' => 'sukses'
]);
} catch (\Throwable $e) {
//throw $th;
DB::rollBack();
return response()->json([
'rc' => 99,
'data' => $e->getMessage()
]);
} catch (QueryException $e) {
DB::rollBack();
return response()->json([
'rc' => 500,
'data' => $e->getMessage()
]);
}
}
public function user_get($id) {
$data = DB::table('master_user')->where('id', $id)->first();
$data->image_url = SpaceController::getFile($data->image_url);
return response()->json($data);
}
public function user_delete(Request $request) {
$get_id = $request->input('id');
DB::beginTransaction();
try {
//code...
$user = User::find($get_id);
SpaceController::deleteFile($user->image_url);
User::find($get_id)->delete();
DB::commit();
return response()->json([
'rc' => 0,
'data' => 'Data Berhasil Dihapus'
]);
} catch (\Throwable $e) {
DB::rollBack();
return response()->json([
'rc' => 99,
'data' => $e->getMessage()
]);
} catch (QueryException $e) {
DB::rollBack();
return response()->json([
'rc' => 500,
'data' => $e->getMessage()
]);
}
}
public function user_reset(Request $request) {
DB::beginTransaction();
try {
//code...
$user = User::find(Auth::user()->id);
$user->password = Hash::make('welcome1');
$user->save();
DB::commit();
return response()->json([
'rc' => 0,
'data' => 'Data Berhasil Dihapus'
]);
} catch (\Throwable $e) {
DB::rollBack();
return response()->json([
'rc' => 99,
'data' => $e->getMessage()
]);
} catch (QueryException $e) {
DB::rollBack();
return response()->json([
'rc' => 500,
'data' => $e->getMessage()
]);
}
}
public function user_change(Request $request) {
DB::beginTransaction();
try {
//code...
$user = User::find(Auth::user()->id);
if(Hash::check($request->password, $user->password)) {
return response()->json([
'rc' => 99,
'data' => 'Password tidak boleh sama dengan password existing'
]);
} else {
$user->password = Hash::make($request->password);
$user->save();
}
DB::commit();
return response()->json([
'rc' => 0,
'data' => 'Data Berhasil Dihapus'
]);
} catch (\Throwable $e) {
DB::rollBack();
return response()->json([
'rc' => 99,
'data' => $e->getMessage()
]);
} catch (QueryException $e) {
DB::rollBack();
return response()->json([
'rc' => 500,
'data' => $e->getMessage()
]);
}
}
public function user_change_password(Request $request) {
DB::beginTransaction();
try {
$user = User::find(Auth::user()->id);
$oldPassCheck = Hash::check($request->input('oldPassword'), $user->password);
if ($oldPassCheck == false) {
return response()->json([
'rc' => 99,
'data' => 'Password Lama Salah.'
]);
}
if ($request->input('newPassword') != $request->input('confirmPassword')) {
return response()->json([
'rc' => 99,
'data' => 'Password Baru dan Konfirmasi Password Harus Sama'
]);
}
if(Hash::check($request->input('newPassword'), $user->password)) {
return response()->json([
'rc' => 99,
'data' => 'Password tidak boleh sama dengan password existing'
]);
}
$regexp = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$^";
if (preg_match($regexp, $request->input('newPassword'))){
$user->password = Hash::make($request->input('newPassword'));
$user->save();
DB::commit();
return response()->json([
'rc' => 0,
'data' => "Password Baru Berhasil Tersimpan"
]);
} else {
return response()->json([
'rc' => 99,
'data' => "Gagal, Format password baru tidak sesuai dengan ketentuan"
]);
}
} catch (\Throwable $e) {
DB::rollBack();
return response()->json([
'rc' => 99,
'data' => $e->getMessage()
]);
} catch (QueryException $e) {
DB::rollBack();
return response()->json([
'rc' => 500,
'data' => $e->getMessage()
]);
}
}
public function user_change_pp(Request $request) {
DB::beginTransaction();
try {
//code...
$user = User::find(Auth::user()->id);
if($request->hasFile('foto_profil_change_pp')){
SpaceController::deleteFile($user->image_url);
// $destination_path = public_path('gallery');
// $image_path = public_path($user->image_url);
// if(File::exists($image_path)) {
// File::delete($image_path);
// }
$files = $request->file('foto_profil_change_pp');
$urlDoc = SpaceController::uploadFile($files, 'user', []);
$user->image_url = $urlDoc;
// $filename = 'User_'.date('Ymd')."_".date('His').'.'.$files->getClientOriginalExtension();
// $upload_success = $files->move($destination_path, $filename);
// $user->image_url = '/gallery/'.$filename;
}
$user->full_name = $request->full_name_change;
$user->user_code = $request->user_code_change;
$user->phone_number = $request->phone_number_change;
$user->save();
DB::commit();
return response()->json([
'rc' => 0,
'data' => 'Data Berhasil Dihapus'
]);
} catch (\Throwable $e) {
DB::rollBack();
return response()->json([
'rc' => 99,
'data' => $e->getMessage()
]);
} catch (QueryException $e) {
DB::rollBack();
return response()->json([
'rc' => 500,
'data' => $e->getMessage()
]);
}
}
public function data(Request $request) {
$type = $request->get('type');
$keyword = $request->get('keyword');
switch ($type) {
case 'mngTeam':
# code...
$dataTeam = DB::table('master_project as mp')
->leftJoin('master_unit as mu','mu.id','=','mp.unit_owner_id')
->leftJoin('master_company as mc','mc.id','=','mp.company_id')
->leftJoin('master_team as mt','mt.team_code','=','mp.team_code')
->leftJoin('master_user as muser','muser.id','=','mt.member_id')
->leftJoin('ref_team_role as rtr', function($join) {
$join->on('rtr.id','=','mt.team_role_id');
$join->on('rtr.company_id','=','mt.company_id');
})
->select("mp.project_name","mp.project_code",DB::raw("(case when (mp.logo_url is not null) then mp.logo_url
else mc.logo_url end) as logo_url"), "mu.unit_name", DB::raw("json_agg(json_build_object('team_role_id', rtr.id, 'nama', muser.full_name,'profil_pict', muser.image_url,'team_role', rtr.definition)) as list_team"),"mt.team_code")
->where('mp.company_id', Auth::user()->company_id)
->when ( !is_null($keyword), function ($query) use($keyword) {
return $query->whereRaw("(LOWER(mp.project_name) LIKE '%" . strtolower($keyword) . "%' OR LOWER(mp.team_code) LIKE '%" . strtolower($keyword) . "%')");
})
->groupByRaw('mp.project_name, mp.project_code, mu.unit_name, mp.logo_url, mc.logo_url, mt.team_code, mp.id')
->orderBy('mp.id', 'desc')
->paginate(3);
$param['team'] = $dataTeam;
$param['paginateLinks'] = (string) $dataTeam->links();
break;
}
return response()->json([
'rc' => 200,
'data' => $param
]);
}
public function dataTable(Request $request) {
$type = $request->get('type');
switch ($type) {
case 'mngTeam':
$data = DB::select("select mu.full_name, mu.image_url, mt.team_code, rtr.definition, mp.project_name, mt.is_active
from master_team mt
join master_project mp on mp.team_code = mt.team_code
join master_user mu on mu.id = mt.member_id
join ref_team_role rtr on rtr.id = mt.team_role_id and rtr.company_id = mp.company_id
order by mt.team_code, mt.member_id");
# code...
break;
case 'company':
if(Auth::user()->role_id == 7) {
$data = DB::select("select mc.*,
(select user_code from master_user where company_id = mc.id and role_id = 6 order by id limit 1) as user_code
from master_company mc");
} else {
$data = DB::select("select mc.*,
(select user_code from master_user where company_id = mc.id and role_id = 6 order by id limit 1) as user_code
from master_company mc where mc.id = ?",[Auth::user()->company_id]);
}
break;
case 'user':
if(Auth::user()->role_id==5) {
$data = DB::select("select mu.*, rr.definition as role_name, mc.client_name, rd.definition as division_name
from master_user mu
join ref_role rr on rr.id = mu.role_id
left join master_client mc on mc.id = mu.client_id
left join ref_division rd on rd.id = mu.division_id
where rr.is_external = true
order by mu.id desc");
} else {
$data = DB::select("select mu.*, rr.definition as role_name, mc.client_name, rd.definition as division_name
from master_user mu
join ref_role rr on rr.id = mu.role_id
left join master_client mc on mc.id = mu.client_id
left join ref_division rd on rd.id = mu.division_id
where rr.is_external = false
order by mu.id desc");
}
break;
case 'client':
$data = DB::select("select * from master_client");
break;
}
return DataTables::of($data)
// ->addIndexColumn()
->addColumn('member_name',function($data) use ($type) {
if($type=='mngTeam') {
$image_url = asset('assets/media/logos/no_img.png');
if($data->image_url) {
// $image_url = $data->image_url;
$image_url = SpaceController::getFile($data->image_url);
}
return '
<div class="d-flex align-items-center">
<div class="symbol symbol-50 flex-shrink-0 mr-4">
<div class="symbol-label" style="background-image: url(\''.$image_url.'\'); background-size: cover; background-repeat: no-repeat;"></div>
</div>
<div>
<a href="#" class="text-dark-75 font-weight-bolder text-hover-primary mb-1 font-size-lg">'.$data->full_name.'</a>
<span class="text-muted font-weight-bold d-block">'.$data->definition.'</span>
</div>
</div>
';
} else if($type == 'company') {
$logo_url = asset('assets/media/logos/no_img.png');
if($data->logo_url) {
// $logo_url = $data->logo_url;
$image_url = SpaceController::getFile($data->logo_url);
}
return '
<div class="d-flex align-items-center">
<div class="symbol symbol-50 flex-shrink-0 mr-4">
<div class="symbol-label" style="background-image: url(\''.$logo_url.'\'); background-size: cover; background-repeat: no-repeat;"></div>
</div>
<div>
<a href="#" onclick="detail('.$data->id.')" class="text-dark-75 font-weight-bolder text-hover-primary mb-1 font-size-lg">'.$data->company_name.'</a>
<span class="text-muted font-weight-bold d-block">'.$data->company_code.'</span>
</div>
</div>
';
} else if($type == 'user') {
$image_url = asset('assets/media/logos/no_img.png');
if($data->image_url) {
// $image_url = $data->image_url;
$image_url = SpaceController::getFile($data->image_url);
}
return '
<div class="d-flex align-items-center">
<div class="symbol symbol-50 flex-shrink-0 mr-4">
<div class="symbol-label" style="background-image: url(\''.$image_url.'\'); background-size: cover; background-repeat: no-repeat;"></div>
</div>
<div>
<a href="#" class="text-dark-75 font-weight-bolder text-hover-primary mb-1 font-size-lg">'.$data->user_code.'</a>
<span class="text-muted font-weight-bold d-block">'.$data->full_name.'</span>
</div>
</div>
';
} else if($type == 'client') {
$logo_url = asset('assets/media/logos/no_img.png');
if($data->logo_url) {
// $logo_url = $data->logo_url;
$logo_url = SpaceController::getFile($data->logo_url);
}
return '
<div class="d-flex align-items-center">
<div class="symbol symbol-50 flex-shrink-0 mr-4">
<div class="symbol-label" style="background-image: url(\''.$logo_url.'\'); background-size: cover; background-repeat: no-repeat;"></div>
</div>
<div>
<a href="#" onclick="detail('.$data->id.')" class="text-dark-75 font-weight-bolder text-hover-primary mb-1 font-size-lg">'.$data->client_name.'</a>
</div>
</div>
';
}
})
->editColumn('division_name', function($data) use($type) {
if($type=='user') {
return $data->division_name?$data->division_name:'-';
}
})
->editColumn('is_active', function($data) use ($type) {
if($type=='mngTeam' || $type=='user' || $type=='client') {
return $data->is_active?'Aktif':'Non Aktif';
}
})
->addColumn('action', function ($data) use ($type, $request) {
$btn = '';
if($type=='user') {
$btn .= ' <li class="navi-item">
<a onclick="edit(`'.$data->id.'`)" href="#" class="navi-link">
<span class="navi-icon"><i class="la la-edit"></i></span>
<span class="navi-text">Edit</span>
</a>
</li>';
$btn .= ' <li class="navi-item">
<a onclick="hapus(`'.$data->id.'`)" href="#" class="navi-link">
<span class="navi-icon"><i class="la la-trash"></i></span>
<span class="navi-text">Hapus</span>
</a>
</li>';
} else if($type=='company') {
$btn .= ' <li class="navi-item">
<a onclick="edit(`'.$data->id.'`)" href="#" class="navi-link">
<span class="navi-icon"><i class="la la-edit"></i></span>
<span class="navi-text">Edit</span>
</a>
</li>';
$btn .= ' <li class="navi-item">
<a onclick="detail(`'.$data->id.'`)" href="#" class="navi-link">
<span class="navi-icon"><i class="la la-layer-group"></i></span>
<span class="navi-text">Detail</span>
</a>
</li>';
} else if($type=='client') {
$btn .= ' <li class="navi-item">
<a onclick="edit(`'.$data->id.'`)" href="#" class="navi-link">
<span class="navi-icon"><i class="la la-edit"></i></span>
<span class="navi-text">Edit</span>
</a>
</li>';
}
/* $btn .= ' <li class="navi-item">
<a onclick="kembalikan(`'.$data->id.'`,`'.$data->postal.'`)" href="#" class="navi-link">
<span class="navi-icon"><i class="la la-undo"></i></span>
<span class="navi-text">Kembalikan Laporan (Undo)</span>
</a>
</li>'; */
return '
<div class="dropdown dropdown-inline">
<a href="javascript:;" class="btn btn-sm btn-clean btn-icon mr-2" data-toggle="dropdown">
<span class="svg-icon svg-icon-md">
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1">
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<rect x="0" y="0" width="24" height="24"/>
<path d="M5,8.6862915 L5,5 L8.6862915,5 L11.5857864,2.10050506 L14.4852814,5 L19,5 L19,9.51471863 L21.4852814,12 L19,14.4852814 L19,19 L14.4852814,19 L11.5857864,21.8994949 L8.6862915,19 L5,19 L5,15.3137085 L1.6862915,12 L5,8.6862915 Z M12,15 C13.6568542,15 15,13.6568542 15,12 C15,10.3431458 13.6568542,9 12,9 C10.3431458,9 9,10.3431458 9,12 C9,13.6568542 10.3431458,15 12,15 Z" fill="#000000"/>
</g>
</svg>
</span>
</a>
<div class="dropdown-menu dropdown-menu-sm dropdown-menu-right" style="z-index:9999;">
<ul class="navi flex-column navi-hover py-2">
<li class="navi-header font-weight-bolder text-uppercase font-size-xs text-primary pb-2">
Choose an action:
</li>
'.$btn.'
</ul>
</div>
</div>
';
})
->rawColumns(['action','member_name'])
->make(true);
}
}