first commit
This commit is contained in:
commit
97ee96f066
|
@ -0,0 +1,18 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[docker-compose.yml]
|
||||
indent_size = 4
|
|
@ -0,0 +1,53 @@
|
|||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=base64:u22Aaio6kG74akCVWIKP0GP5tL9PQyqIrURDZ5w0cEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=https://chat.progriva.com
|
||||
APP_FORCE_HTTPS=true
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=chat_adeknyarandy1
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DRIVER=local
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
# MAIL_MAILER=smtp
|
||||
# MAIL_HOST=kelola.biz.id
|
||||
# MAIL_PORT=465
|
||||
# MAIL_USERNAME=info@kelola.biz.id
|
||||
# MAIL_PASSWORD="default123@#"
|
||||
# MAIL_ENCRYPTION=ssl
|
||||
# MAIL_FROM_ADDRESS=info@kelola.biz.id
|
||||
# MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=cd5094c0f1086272cf69ed521c5ec316
|
||||
AWS_SECRET_ACCESS_KEY=bd99a32384636d52baa21504faafe0d60c5a4a6449131bccb7ba6468d7010021
|
||||
AWS_DEFAULT_REGION=auto
|
||||
AWS_BUCKET=cdn-progriva
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
|
@ -0,0 +1,52 @@
|
|||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=laravel
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DRIVER=local
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=mailhog
|
||||
MAIL_PORT=1025
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS=null
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
|
@ -0,0 +1,8 @@
|
|||
RewriteEngine On
|
||||
RewriteCond %{HTTPS} off
|
||||
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteRule ^(.*)$ public/$1 [L]
|
||||
</IfModule>
|
|
@ -0,0 +1,14 @@
|
|||
php:
|
||||
preset: laravel
|
||||
version: 8
|
||||
disabled:
|
||||
- no_unused_imports
|
||||
finder:
|
||||
not-name:
|
||||
- index.php
|
||||
- server.php
|
||||
js:
|
||||
finder:
|
||||
not-name:
|
||||
- webpack.mix.js
|
||||
css: true
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Konselor'
|
||||
];
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Konselor\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class KonselorDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Model::unguard();
|
||||
|
||||
// $this->call("OthersTableSeeder");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Konselor\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use DataTables;
|
||||
|
||||
use App\Enums\GlobalEnum as Status;
|
||||
use App\Models\Ticket;
|
||||
use App\Models\Konselor;
|
||||
use App\Models\User;
|
||||
use App\Models\LogActivites;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class KonselorController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Halaman Utama',
|
||||
];
|
||||
|
||||
$getTotalTicketOpen = Ticket::where('is_status', 1)->count();
|
||||
$getTotalTicketClose = Ticket::where('is_status', 4)->count();
|
||||
$getTotalTicket = Ticket::count();
|
||||
$getTotalAduan = Ticket::where('konselor_id', '=', Auth::user()->id)->orderBy('created_at', 'desc')->get();
|
||||
|
||||
return view('konselor::index', compact('data', 'getTotalAduan', 'getTotalTicketOpen', 'getTotalTicketClose', 'getTotalTicket'));
|
||||
}
|
||||
|
||||
public function profil()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Akun saya',
|
||||
'records' => User::where('id', user()->id)->first()
|
||||
];
|
||||
|
||||
$detail = Konselor::where('user_id', user()->id)->first();
|
||||
return view('konselor::account.profile', compact('data', 'detail'));
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
$id = user()->id;
|
||||
$validator = Validator::make($request->all(), [
|
||||
'nip' => 'required',
|
||||
'alamat' => 'required',
|
||||
'telepon' => 'required',
|
||||
'agama' => 'required',
|
||||
'name' => 'required',
|
||||
'email' => 'required|email',
|
||||
'image' => 'image|mimes:jpg,jpeg,png,svg|max:7048',
|
||||
], [
|
||||
'image.mimes' => 'Tipe file yang diunggah harus jpg, jpeg, png, atau svg.',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
// Cari data berdasarkan ID
|
||||
$user = User::find($id);
|
||||
$detail = Konselor::where('user_id', $id)->first();
|
||||
|
||||
$foto_namaBaru = null;
|
||||
|
||||
if ($request->hasFile('image') && $request->file('image')->isValid()) {
|
||||
$foto_namaBaru = $request->file('image')->store('public/images');
|
||||
}
|
||||
|
||||
// Jika data ditemukan
|
||||
if ($user) {
|
||||
// Update data dengan data baru dari form yang telah dibersihkan
|
||||
$user->name = $request->input('name');
|
||||
$user->email = $request->input('email');
|
||||
!empty($request->input('password')) ? $user->password = bcrypt($request->input('password')) : $user->password;
|
||||
$user->username = Str::before($user->email, '@') . rand(100, 999);
|
||||
$user->thumbnail = $foto_namaBaru;
|
||||
|
||||
$detail->nip = $request->input('nip');
|
||||
$detail->alamat = $request->input('alamat');
|
||||
$detail->agama = $request->input('agama');
|
||||
$detail->telepon = $request->input('telepon');
|
||||
|
||||
// Simpan perubahan pada database
|
||||
$user->save();
|
||||
$detail->save();
|
||||
return redirect()->back()->with('swal', swal_alert('success', 'You are successfully modify data'));
|
||||
} else {
|
||||
return redirect()->back()->with('swal', swal_alert('error', 'Unexpected error'));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,366 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Konselor\Http\Controllers;
|
||||
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use DataTables;
|
||||
use Modules\Seller\Entities\TicketModel;
|
||||
use Modules\Seller\Entities\TicketResponseModel;
|
||||
use Modules\Seller\Events\TicketCreated;
|
||||
use App\Enums\GlobalEnum;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\Models\Siswa;
|
||||
use App\Models\User;
|
||||
use App\Models\Konselor;
|
||||
use App\Models\LogActivites;
|
||||
|
||||
class TicketController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = TicketModel::where('konselor_id', user()->id)->orderBy('created_at', 'desc');
|
||||
// Convert the Eloquent Collection to a regular PHP array
|
||||
$data->each(function ($item, $key) {
|
||||
$item->rowIndex = $key + 1;
|
||||
});
|
||||
|
||||
return Datatables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('title-post', function($row){
|
||||
$text = '
|
||||
<p class="mb-0">' . $row->subject . '</p>
|
||||
<p class="mb-0 small">Terakhir diperbarui pada ' . date_formatting($row->updated_at, 'timeago') . '</p>
|
||||
';
|
||||
return $text;
|
||||
})
|
||||
->addColumn('siswa', function($row){
|
||||
return User::where('id', $row->user_id)->first()->name;
|
||||
})
|
||||
->addColumn('action', function($row){
|
||||
$view = route('ticket.view', ['id' => $row->id]);
|
||||
$delete = route('ticket.delete', ['id' => $row->id]);
|
||||
$btn = '
|
||||
<a href="' . $view . '" class="btn btn-light btn-sm px-4"><i class="ki-outline ki-eye"></i></a>
|
||||
<a data-url="' . $delete . '" href="#" class="btn btn-light btn-sm deleteContent px-4"><i class="ki-outline ki-trash"></i></a>
|
||||
';
|
||||
return $btn;
|
||||
})
|
||||
->addColumn('status', function($row){
|
||||
if ($row->is_status == 1) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-dark text-dark">Pending</span>';
|
||||
} elseif($row->is_status == 2) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-primary text-primary">User Membalas</span>';
|
||||
} elseif($row->is_status == 3) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-info text-info">Konselor Membalas</span>';
|
||||
} elseif($row->is_status == 4) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-danger text-danger">Ditutup</span>';
|
||||
}
|
||||
})
|
||||
->addColumn('jenis', function($row){
|
||||
if ($row->type == 1) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-primary text-primary">Aplikasi</span>';
|
||||
} elseif($row->type == 2) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-success text-success">Face to Face<br>pada<br>'.$row->meet_at.'</span>';
|
||||
}
|
||||
})
|
||||
->addColumn('approval', function($row){
|
||||
if ($row->is_approval_konselor == 3) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-dark text-dark">Wali Menunggu Persetujuan</span>';
|
||||
} elseif($row->is_approval_konselor == 1) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-success text-success">Wali Disetujui</span>';
|
||||
} elseif($row->is_approval_konselor == 4) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-danger text-danger">Persetujuan Ditolak</span>';
|
||||
} else {
|
||||
return '<span class="mb-1 badge font-medium bg-light-info text-info">-</span>';
|
||||
}
|
||||
})
|
||||
->addColumn('priority', function($row){
|
||||
if ($row->is_priority == GlobalEnum::isTicketPriorityNormal) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-info text-info">Normal</span>';
|
||||
} elseif($row->is_priority == GlobalEnum::isTicketPriorityMedium) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-primary text-primary">Sedang</span>';
|
||||
} elseif($row->is_priority == GlobalEnum::isTicketPriorityHigh) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-danger text-danger">Parah</span>';
|
||||
}
|
||||
})
|
||||
->rawColumns(['title-post','action','status','priority','siswa','approval', 'jenis'])
|
||||
->filter(function ($query) use ($request) {
|
||||
if ($request->has('search')) {
|
||||
$search = $request->get('search')['value'];
|
||||
|
||||
$decodedSearch = json_decode($search, true);
|
||||
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
$filters = $decodedSearch;
|
||||
|
||||
if (isset($filters['startDate']) && !empty($filters['startDate'])) {
|
||||
$query->whereDate('created_at', '>=', $filters['startDate']);
|
||||
}
|
||||
|
||||
if (isset($filters['endDate']) && !empty($filters['endDate'])) {
|
||||
$query->whereDate('created_at', '<=', $filters['endDate']);
|
||||
}
|
||||
|
||||
if (isset($filters['subjek']) && !empty($filters['subjek'])) {
|
||||
if ($filters['subjek'] === 'Yang Lain') {
|
||||
$query->whereNotIn('subjek', ['Non Akademis', 'Akademis', 'Masuk Universitas', 'Masalah Keluarga']);
|
||||
} else {
|
||||
$query->where('subjek', 'LIKE', $filters['subjek'] . "%");
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($filters['jenis']) && !empty($filters['jenis'])) {
|
||||
$query->where('type', '=', $filters['jenis']);
|
||||
}
|
||||
|
||||
if (isset($filters['status']) && !empty($filters['status'])) {
|
||||
$query->where('is_status', '=', $filters['status']);
|
||||
}
|
||||
|
||||
if (isset($filters['kasus']) && !empty($filters['kasus'])) {
|
||||
$query->where('is_priority', '=', $filters['kasus']);
|
||||
}
|
||||
} else {
|
||||
// $search is a regular string
|
||||
$filterCategory = explode('|', $search);
|
||||
if ($filterCategory[0] === 'status') {
|
||||
if (!empty($filterCategory[1])) {
|
||||
$query->where('is_status', 'LIKE', "%$filterCategory[1]%");
|
||||
} else {
|
||||
$query->get();
|
||||
}
|
||||
} elseif ($filterCategory[0] === 'user') {
|
||||
if (!empty($filterCategory[1])) {
|
||||
$query->where('user_id', '=', User::where('name', 'like', "%$filterCategory[1]%")->first()->id);
|
||||
} else {
|
||||
$query->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
->make(true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Riwayat Bimbingan & Konseling',
|
||||
'button' => true,
|
||||
'module' => [
|
||||
'url' => site_url('konselor', 'ticket/create'),
|
||||
'name' => 'Jadwal B.K'
|
||||
]
|
||||
];
|
||||
|
||||
return view('konselor::ticket.index', compact('data'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Jadwal Bimbingan & Konseling',
|
||||
];
|
||||
|
||||
$getListSiswa = User::where('level', GlobalEnum::isSiswa)->get();
|
||||
return view('konselor::ticket.add', compact('data', 'getListSiswa'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'siswa_id' => 'required',
|
||||
'subject' => 'required',
|
||||
'message' => 'required',
|
||||
'is_priority' => 'required',
|
||||
'type' => 'required'
|
||||
]);
|
||||
|
||||
if($validator->fails()) {
|
||||
return redirect()->back()->with('swal', swal_alert('error', $validator->errors()->first()))->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$ticket = new TicketModel([
|
||||
'id' => Str::uuid(),
|
||||
'user_id' => $input['siswa_id'],
|
||||
'konselor_id' => user()->id,
|
||||
'subject' => $input['subject'],
|
||||
'is_priority' => $input['is_priority'],
|
||||
'senderAs' => 1,
|
||||
'type' => $input['type'],
|
||||
'is_status' => 1,
|
||||
]);
|
||||
|
||||
if($input['type'] == 1) {
|
||||
$check = TicketModel::where('subject', $ticket->subject)->count();
|
||||
$messages = "Siswa ingin melakukan bimbingan secara virtual aplikasi";
|
||||
$ticketResponse = new TicketResponseModel();
|
||||
$ticketResponse->id = Str::uuid();
|
||||
$ticketResponse->id_ticket = $ticket->id; // Isi dengan nilai yang sesuai
|
||||
$ticketResponse->user_id = $ticket->user_id; // Isi dengan nilai yang sesuai
|
||||
$ticketResponse->message = clean($messages);
|
||||
$ticketResponse->save();
|
||||
}
|
||||
|
||||
$postTicket = $ticket->save();
|
||||
if($check == 0) {
|
||||
if($postTicket) {
|
||||
return redirect()->to(site_url('konselor', 'ticket'))->with('swal', swal_alert('success', 'Anda berhasil membuka tiket baru.'));
|
||||
} else {
|
||||
return redirect()->back()->with('swal', swal_alert('error', 'Terjadi kesalahan saat membuka tiket.'));
|
||||
}
|
||||
} else {
|
||||
return redirect()->back()->with('swal', swal_alert('error', 'Ditemukan data yang telah ada'));
|
||||
}
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'message' => 'required',
|
||||
]);
|
||||
|
||||
if($validator->fails()) {
|
||||
return redirect()->back()->with('swal', swal_alert('error', $validator->errors()->first()))->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$ticket = TicketModel::find($id);
|
||||
if($ticket) {
|
||||
$post = new TicketResponseModel([
|
||||
'id' => Str::uuid(),
|
||||
'id_ticket' => $id,
|
||||
'user_id' => auth()->user()->id,
|
||||
'message' => $input['message']
|
||||
]);
|
||||
|
||||
$ticket->is_status = 3;
|
||||
if($post->save() && $ticket->save()) {
|
||||
return redirect()->route('konselor.ticket.detail', ['id' => $id])->with('swal', swal_alert('success', 'Anda berhasil membalas tiket.'));
|
||||
} else {
|
||||
return redirect()->route('konselor.ticket.detail', ['id' => $id])->with('swal', swal_alert('error', 'Terjadi kesalahan saat membalas tiket.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function view($id)
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => TicketModel::where('id', $id)->first()->subject
|
||||
];
|
||||
|
||||
$detail = TicketModel::where('id', $id)->first();
|
||||
$siswa = User::where('id', $detail->user_id)->first()->name;
|
||||
$nis = Siswa::where('user_id', $detail->user_id)->first()->nis;
|
||||
$ticketResponse = TicketResponseModel::where('id_ticket', $id)->orderBy('created_at', 'asc')->get();
|
||||
return view('konselor::ticket.detail', compact('data', 'nis', 'ticketResponse', 'detail', 'siswa'));
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
$ticket = TicketModel::find($id);
|
||||
if($ticket) {
|
||||
$detailReply = TicketResponseModel::where('id_ticket', $ticket->id)->get();
|
||||
|
||||
if($ticket->delete() && $detailReply->delete()) {
|
||||
return redirect()->route('konselor.ticket')->with('swal', swal_alert('success', 'Anda berhasil menghapus tiket.'));
|
||||
} else {
|
||||
return redirect()->route('konselor.ticket')->with('swal', swal_alert('error', 'Terjadi kesalahan saat menghapus tiket.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function closed($id)
|
||||
{
|
||||
$ticket = TicketModel::find($id);
|
||||
if($ticket) {
|
||||
$ticket->is_status = 4;
|
||||
if($ticket->save()) {
|
||||
return redirect()->route('konselor.ticket')->with('swal', swal_alert('success', 'Anda berhasil menghapus tiket.'));
|
||||
} else {
|
||||
return redirect()->route('konselor.ticket')->with('swal', swal_alert('error', 'Terjadi kesalahan saat menghapus tiket.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function accept()
|
||||
{
|
||||
$chat = TicketModel::find(segment(4));
|
||||
if($chat)
|
||||
{
|
||||
$chat->is_approval_konselor = 1;
|
||||
$chat->save();
|
||||
|
||||
return redirect()->back()->with('swal', swal_alert('success', 'Request berhasil disetujui.'));
|
||||
} else {
|
||||
return redirect()->back()->with('swal', swal_alert('error', 'Tidak ditemukan data yang dituju.'));
|
||||
}
|
||||
}
|
||||
|
||||
public function decline()
|
||||
{
|
||||
$chat = TicketModel::find(segment(4));
|
||||
if($chat)
|
||||
{
|
||||
$chat->is_approval_konselor = 4;
|
||||
$chat->save();
|
||||
|
||||
return redirect()->back()->with('swal', swal_alert('success', 'Request berhasil ditolak.'));
|
||||
} else {
|
||||
return redirect()->back()->with('swal', swal_alert('error', 'Tidak ditemukan data yang dituju.'));
|
||||
}
|
||||
}
|
||||
|
||||
public function cetak(Request $request)
|
||||
{
|
||||
$startDate = $request->input('start_date', '');
|
||||
$endDate = $request->input('end_date', '');
|
||||
$subjek = $request->input('subjek', '');
|
||||
$jenis = $request->input('jenis', '');
|
||||
$status = $request->input('status', '');
|
||||
$kasus = $request->input('kasus', '');
|
||||
|
||||
|
||||
$query = TicketModel::query();
|
||||
|
||||
if (!empty($startDate)) {
|
||||
$query->whereDate('created_at', '>=', $startDate);
|
||||
}
|
||||
|
||||
if (!empty($endDate)) {
|
||||
$query->whereDate('created_at', '<=', $endDate);
|
||||
}
|
||||
|
||||
if ($subjek === 'Yang Lain') {
|
||||
$query->whereNotIn('subjek', ['Non Akademis', 'Akademis', 'Masuk Universitas', 'Masalah Keluarga']);
|
||||
} elseif (!empty($subjek)) {
|
||||
$query->where('subjek', 'LIKE', $subjek . "%");
|
||||
}
|
||||
|
||||
if (!empty($jenis)) {
|
||||
$query->where('type', '=', $jenis);
|
||||
}
|
||||
|
||||
if (!empty($status)) {
|
||||
$query->where('is_status', '=', $status);
|
||||
}
|
||||
|
||||
if (!empty($kasus)) {
|
||||
$query->where('is_priority', '=', $kasus);
|
||||
}
|
||||
|
||||
$report = $query->get();
|
||||
|
||||
$periode = $startDate . ' s/d ' . $endDate;
|
||||
|
||||
return view('konselor::ticket.cetak', compact('report', 'periode'));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,217 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Konselor\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use DataTables;
|
||||
|
||||
use App\Enums\GlobalEnum;
|
||||
use App\Models\Ticket;
|
||||
use App\Models\Konselor;
|
||||
use App\Models\User;
|
||||
use App\Models\Wali;
|
||||
use App\Models\LogActivites;
|
||||
|
||||
class WaliController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = User::select('*')->where('level', GlobalEnum::isWaliMurid)->orderBy('created_at', 'desc');
|
||||
// Convert the Eloquent Collection to a regular PHP array
|
||||
$data->each(function ($item, $key) {
|
||||
$item->rowIndex = $key + 1;
|
||||
});
|
||||
|
||||
return Datatables::eloquent($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('title-post', function($row) {
|
||||
return '
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="symbol symbol-25px symbol-circle">
|
||||
<div class="symbol-label" style="background-image:url(' . gravatar_team($row->email) . ')"></div>
|
||||
</div>
|
||||
<div class="ms-3"><span>' . $row->name . '</span></div>
|
||||
</div>
|
||||
';
|
||||
})
|
||||
->addColumn('siswa', function($row) {
|
||||
$siswa_id = $row->wali->first()->siswa_id;
|
||||
return User::where('id', $siswa_id)->first()->name;
|
||||
})
|
||||
->addColumn('action', function($row){
|
||||
$view = route('users.show', ['id' => $row->id]);
|
||||
$edit = route('users.edit', ['id' => $row->id]);
|
||||
$delete = route('users.delete', ['id' => $row->id]);
|
||||
$btn = '
|
||||
<a href="' . $view . '" class="btn btn-light btn-sm px-4"><i class="ki-outline ki-eye"></i></a>
|
||||
<a href="' . $edit . '" class="btn btn-light btn-sm px-4"><i class="ki-outline ki-pencil"></i></a>
|
||||
<a data-url="' . $delete . '" href="#" class="btn btn-light btn-sm deleteContent px-4"><i class="ki-outline ki-trash"></i></a>
|
||||
';
|
||||
return $btn;
|
||||
})
|
||||
->addColumn('status', function($row){
|
||||
if ($row->status == GlobalEnum::isActive) {
|
||||
return '<span class="mb-1 badge font-medium badge-light-success py-3 px-4 fs-7">Active</span>';
|
||||
} elseif($row->status == GlobalEnum::isInactive) {
|
||||
return '<span class="mb-1 badge font-medium badge-light-primary py-3 px-4 fs-7">Non Active</span>';
|
||||
} elseif($row->status == GlobalEnum::isDeactive) {
|
||||
return '<span class="mb-1 badge font-medium badge-light-danger py-3 px-4 fs-7">Deactivated</span>';
|
||||
} else {
|
||||
return '<span class="mb-1 badge font-medium badge-light-warning py-3 px-4 fs-7">Not Verified</span>';
|
||||
}
|
||||
})
|
||||
->rawColumns(['title-post','siswa','action','status'])
|
||||
->filter(function ($query) use ($request) {
|
||||
if ($request->has('search')) {
|
||||
$search = $request->get('search')['value'];
|
||||
|
||||
$filterCategory = explode('|', $search);
|
||||
if($filterCategory[0] === 'status') {
|
||||
if(!empty($filterCategory[1])) {
|
||||
$query->where('is_status', '=', $filterCategory[1]);
|
||||
} else {
|
||||
$query->get();
|
||||
}
|
||||
} elseif($filterCategory[0] === 'user') {
|
||||
if(!empty($filterCategory[1])) {
|
||||
$query->where('name', 'LIKE', "%$filterCategory[1]%");
|
||||
} else {
|
||||
$query->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
->make(true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Wali Murid',
|
||||
'button' => true,
|
||||
'module' => [
|
||||
'url' => route('konselor.wali.create'),
|
||||
'name' => 'Create New'
|
||||
]
|
||||
];
|
||||
|
||||
return view('konselor::wali.index', compact('data'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Tambah baru',
|
||||
];
|
||||
|
||||
$getListSiswa = User::where('level', GlobalEnum::isSiswa)->get();
|
||||
return view('konselor::wali.add', compact('data', 'getListSiswa'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'email' => 'required|email',
|
||||
'password' => 'required',
|
||||
'status' => 'required',
|
||||
'siswa_id' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
|
||||
$post = new User([
|
||||
'name' => $input['name'],
|
||||
'username' => Str::before($input['email'], '@') . rand(100, 999),
|
||||
'email' => $input['email'],
|
||||
'password' => bcrypt($input['password']),
|
||||
'status' => $input['status'],
|
||||
'level' => GlobalEnum::isWaliMurid,
|
||||
'thumbnail' => empty($foto_namaBaru) ? '' : $foto_namaBaru,
|
||||
]);
|
||||
|
||||
$check = User::where('email', $input['email'])->count();
|
||||
if ($check == 0) {
|
||||
if ($post->save()) {
|
||||
$detail = User::where('email', $input['email'])->first();
|
||||
$postDetail = new Wali([
|
||||
'id' => Str::uuid(),
|
||||
'user_id' => $detail->id,
|
||||
'siswa_id' => $input['siswa_id']
|
||||
]);
|
||||
|
||||
$postDetail->save();
|
||||
return redirect()->route('konselor.wali')->with('swal', swal_alert('success', 'You have successfully added data'));
|
||||
} else {
|
||||
return redirect()->route('konselor.wali')->with('swal', swal_alert('error', 'An error occurred in the query'));
|
||||
}
|
||||
} else {
|
||||
return redirect()->route('konselor.wali')->with('swal', swal_alert('error', 'Email already exists'));
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => User::where('id', $id)->first()->name,
|
||||
'records' => User::where('id', $id)->first()
|
||||
];
|
||||
|
||||
$getListSiswa = User::where('level', GlobalEnum::isSiswa)->get();
|
||||
$detailSiswa = Wali::where('user_id', $id)->first();
|
||||
return view('konselor::wali.edit', compact('data', 'id', 'getListSiswa', 'detailSiswa'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'email' => 'required|email',
|
||||
'status' => 'required',
|
||||
'siswa_id' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$user = User::find($id);
|
||||
$detail = Wali::where('user_id', $id)->first();
|
||||
|
||||
$user->name = $input['name'];
|
||||
$user->email = $input['email'];
|
||||
!empty($request->input('password')) ? $user->password = bcrypt($request->input('password')) : $user->password;
|
||||
$user->status = $request->input('status');
|
||||
$user->username = Str::before($user->email, '@') . rand(100, 999);
|
||||
|
||||
$detail->siswa_id = $input['siswa_id'];
|
||||
|
||||
// save
|
||||
if ($user->save() && $detail->save()) {
|
||||
return redirect()->route('konselor.wali')->with('swal', swal_alert('success', 'You have successfully updated data'));
|
||||
} else {
|
||||
return redirect()->route('konselor.wali')->with('swal', swal_alert('error', 'An error occurred in the query'));
|
||||
}
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
$detail = Wali::where('user_id', $id)->first();
|
||||
$user = User::find($id);
|
||||
if ($user->delete() && $detail->delete()) {
|
||||
return redirect()->route('konselor.wali')->with('swal', swal_alert('success', 'You have successfully deleted data'));
|
||||
} else {
|
||||
return redirect()->route('konselor.wali')->with('swal', swal_alert('error', 'An error occurred in the query'));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Konselor\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Database\Eloquent\Factory;
|
||||
|
||||
class KonselorServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* @var string $moduleName
|
||||
*/
|
||||
protected $moduleName = 'Konselor';
|
||||
|
||||
/**
|
||||
* @var string $moduleNameLower
|
||||
*/
|
||||
protected $moduleNameLower = 'konselor';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->publishes([
|
||||
module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'),
|
||||
], 'config');
|
||||
$this->mergeConfigFrom(
|
||||
module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||
|
||||
$sourcePath = module_path($this->moduleName, 'Resources/views');
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath
|
||||
], ['views', $this->moduleNameLower . '-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (\Config::get('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
return $paths;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Konselor\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The module namespace to assume when generating URLs to actions.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $moduleNamespace = 'Modules\Konselor\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('Konselor', '/Routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('Konselor', '/Routes/api.php'));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
@include('components.theme.pages.header')
|
||||
|
||||
<section>
|
||||
<!-- basic table -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form action="{{ site_url('konselor', 'update') }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="row mb-4">
|
||||
<div class="col">
|
||||
<label class="form-label">NIP<sup class="text-danger">*</sup></label>
|
||||
<input type="number" name="nip" value="{{ $detail['nip'] }}" autocomplete="off" class="form-control form-control-solid mt-2 {{ $errors->has('nip') ? 'is-invalid' : '' }}" placeholder="Enter NIP">
|
||||
@error('nip') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-label">Alamat Lengkap<sup class="text-danger">*</sup></label>
|
||||
<input type="text" name="alamat" value="{{ $detail['alamat'] }}" autocomplete="off" class="form-control form-control-solid mt-2 {{ $errors->has('alamat') ? 'is-invalid' : '' }}" placeholder="Enter Alamat Lengkap">
|
||||
@error('alamat') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col">
|
||||
<label class="form-label">Alamat Email<sup class="text-danger">*</sup></label>
|
||||
<input type="email" name="email" value="{{ $data['records']['email'] }}" autocomplete="off" class="form-control form-control-solid mt-2 {{ $errors->has('email') ? 'is-invalid' : '' }}" placeholder="Enter Email Address">
|
||||
@error('email') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-label">Nama Lengkap<sup class="text-danger">*</sup></label>
|
||||
<input type="text" name="name" value="{{ $data['records']['name'] }}" autocomplete="off" class="form-control form-control-solid mt-2 {{ $errors->has('name') ? 'is-invalid' : '' }}" placeholder="Enter Name">
|
||||
@error('name') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-4" data-kt-password-meter="true">
|
||||
<label class="form-label">Password<sup class="text-danger">*</sup></label>
|
||||
<div class="position-relative mb-3">
|
||||
<input class="form-control form-control-lg form-control-solid mt-2 {{ $errors->has('password') ? 'is-invalid' : '' }}"
|
||||
type="password" value="{{ old('password') }}" placeholder="Enter Password" name="password" autocomplete="off" />
|
||||
|
||||
<!--begin::Visibility toggle-->
|
||||
<span class="btn btn-sm btn-icon position-absolute translate-middle top-50 end-0 me-n2"
|
||||
data-kt-password-meter-control="visibility">
|
||||
<i class="ki-duotone ki-eye-slash fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span><span class="path4"></span></i>
|
||||
<i class="ki-duotone ki-eye d-none fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span></i>
|
||||
</span>
|
||||
<!--end::Visibility toggle-->
|
||||
</div>
|
||||
|
||||
<!--begin::Highlight meter-->
|
||||
<div class="d-flex align-items-center mb-3" data-kt-password-meter-control="highlight">
|
||||
<div class="flex-grow-1 bg-secondary bg-active-success rounded h-5px me-2"></div>
|
||||
<div class="flex-grow-1 bg-secondary bg-active-success rounded h-5px me-2"></div>
|
||||
<div class="flex-grow-1 bg-secondary bg-active-success rounded h-5px me-2"></div>
|
||||
<div class="flex-grow-1 bg-secondary bg-active-success rounded h-5px"></div>
|
||||
</div>
|
||||
|
||||
@error('password') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
<div class="text-muted">
|
||||
Use 8 or more characters with a mix of letters, numbers & symbols.
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-4">
|
||||
<div class="col">
|
||||
<label class="form-label">Nomer Telepon<sup class="text-danger">*</sup></label>
|
||||
<input type="number" name="telepon" value="{{ $detail['telepon'] }}" autocomplete="off" class="form-control form-control-solid mt-2 {{ $errors->has('telepon') ? 'is-invalid' : '' }}" placeholder="Enter Telepon">
|
||||
@error('telepon') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-label">Agama<sup class="text-danger">*</sup></label>
|
||||
<select name="agama" class="form-select form-select-solid mt-2 {{ $errors->has('agama') ? 'is-invalid' : '' }}">
|
||||
@foreach ([1,2,3,4] as $rolez)
|
||||
@php $selected = $rolez == $detail['agama'] ? 'selected' : '' @endphp
|
||||
@php $name = $rolez == 1 ? 'Islam' : ($rolez == 2 ? 'Kristen' : ($rolez == 3 ? 'Buddha' : 'Konghucu')) @endphp
|
||||
<option value="{{ $rolez }}" {{ $selected }}>{{ $name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('agama') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group mb-2">
|
||||
<label class="form-label">Thumbnail<sup class="text-danger">*</sup></label>
|
||||
<input type="file" name="image" autocomplete="off" class="form-control form-control-solid mt-2 {{ $errors->has('image') ? 'is-invalid' : '' }}" placeholder="Enter Foto">
|
||||
@error('image') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-0">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<a href="{{ site_url('konselor', '/') }}" class="btn btn-light btn-light">Back</a>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,123 @@
|
|||
@include('components.theme.pages.header')
|
||||
<section>
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
<div class="card bg-body hoverable card-xl-stretch mb-xl-8">
|
||||
<div class="card-body">
|
||||
<i class="ki-outline ki-notepad text-dark fs-2x ms-n1"></i>
|
||||
<div class="text-gray-900 fw-bold fs-2 mb-2 mt-5">
|
||||
{{ $getTotalTicket }}
|
||||
</div>
|
||||
<div class="fw-semibold text-gray-400">
|
||||
Total Bimbingan
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="card bg-body hoverable card-xl-stretch mb-xl-8">
|
||||
<div class="card-body">
|
||||
<i class="ki-outline ki-file-up text-danger fs-2x ms-n1"></i>
|
||||
<div class="text-gray-900 fw-bold fs-2 mb-2 mt-5">
|
||||
{{ $getTotalTicketOpen }}
|
||||
</div>
|
||||
<div class="fw-semibold text-gray-400">
|
||||
Total Bimbingan Terbuka
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="card bg-body hoverable card-xl-stretch mb-xl-8">
|
||||
<div class="card-body">
|
||||
<i class="ki-outline ki-tablet-ok text-primary fs-2x ms-n1"></i>
|
||||
<div class="text-gray-900 fw-bold fs-2 mb-2 mt-5">
|
||||
{{ $getTotalTicketClose }}
|
||||
</div>
|
||||
<div class="fw-semibold text-gray-400">
|
||||
Total Bimbingan Selesai
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Bimbingan & Konseling</h3>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table align-middle table-row-bordered table-row-solid gy-4 gs-9">
|
||||
<thead>
|
||||
<tr class="text-start text-gray-400 fw-bold fs-7 text-uppercase gs-0">
|
||||
<th>No</th>
|
||||
<th>Subjek</th>
|
||||
<th>Jenis</th>
|
||||
<th>Tipe</th>
|
||||
<th>Siswa</th>
|
||||
<th>Status</th>
|
||||
<th>Tanggal Dibuat</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-gray-600 fw-semibold">
|
||||
@if(empty($getTotalAduan))
|
||||
<tr>
|
||||
<td colspan="6" class="text-center">Tidak ada data Bimbingan & Konseling...</td>
|
||||
</tr>
|
||||
@else
|
||||
@php
|
||||
$no = 1;
|
||||
@endphp
|
||||
@foreach($getTotalAduan as $rows)
|
||||
@php
|
||||
$siswa = \App\Models\User::where('id', $rows->user_id)->first();
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{ $no++ }}</td>
|
||||
<td>{{ $rows->subject }}</td>
|
||||
<td>
|
||||
@if($rows->type == 1)
|
||||
<span class="badge badge-light-primary fs-7 fw-bold">Aplikasi</span>
|
||||
@elseif($rows->type == 2)
|
||||
<span class="badge badge-light-success fs-7 fw-bold">Face to Face</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($rows->is_priority == 1)
|
||||
<span class="badge badge-light-primary fs-7 fw-bold">Umum</span>
|
||||
@elseif($rows->is_priority == 2)
|
||||
<span class="badge badge-light-warning fs-7 fw-bold">Sedang</span>
|
||||
@else
|
||||
<span class="badge badge-light-danger fs-7 fw-bold">Parah</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $siswa->name }}</td>
|
||||
<td>
|
||||
@if ($rows->is_status == 1)
|
||||
<span class="mb-1 badge font-medium bg-light-dark text-dark py-3 px-4 fs-7 text-center">Menunggu Respon</span>
|
||||
@elseif($rows->is_status == 2)
|
||||
<span class="mb-1 badge font-medium bg-light-warning text-warning py-3 px-4 fs-7 text-center">Telah dibalas siswa</span>
|
||||
@elseif($rows->is_status == 3)
|
||||
<span class="mb-1 badge font-medium bg-light-primary text-primary py-3 px-4 fs-7 text-center">Telah dibalas konselor</span>
|
||||
@elseif($rows->is_status == 4)
|
||||
<span class="mb-1 badge font-medium bg-light-danger text-danger py-3 px-4 fs-7 text-center">Kasus ditutup</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $rows->created_at }}</td>
|
||||
<td>
|
||||
<a href="{{ site_url('konselor', 'ticket/view') . '/' . $rows->id }}" class="btn btn-sm btn-light"><i class="ki-outline ki-arrow-up-right fs-4"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,88 @@
|
|||
@include('components.theme.pages.header')
|
||||
|
||||
<section>
|
||||
<!-- basic table -->
|
||||
{{ Form::open(['route' => 'konselor.ticket.store']) }}
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h6 class="card-title">Jadwal Bimbingan & Konseling</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group mb-4">
|
||||
<label class="form-label">Jenis Keperluan<sup class="text-danger">*</sup></label>
|
||||
<select class="form-control" name="subject">
|
||||
<option value="">Pilih Jenis Keperluan</option>
|
||||
<option value="Non Akademis">Non Akademis</option>
|
||||
<option value="Akademis">Akademis</option>
|
||||
<option value="Masuk Universitas">Masuk Universitas</option>
|
||||
<option value="Masalah Keluarga">Masalah Keluarga</option>
|
||||
<option value="Yang Lain">Yang Lain</option>
|
||||
</select>
|
||||
@error('subject') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="form-group mb-4">
|
||||
<label class="form-label mb-4">Atur Siswa (pilih salah satu)</label>
|
||||
<select class="form-control form-select-solid" data-control="select2" name="siswa_id" id="siswa_id">
|
||||
@foreach($getListSiswa as $siswa)
|
||||
<option value="{{ $siswa->id }}">{{ $siswa->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group mb-4">
|
||||
<label class="form-label mb-4">Tingkat Masalah<sup class="text-danger">*</sup></label>
|
||||
<select name="is_priority" class="form-select form-select-solid mt-2 {{ $errors->has('is_priority') ? 'is-invalid' : '' }}">
|
||||
@foreach ([1,2,3] as $priority)
|
||||
@php $name = $priority == 1 ? 'Normal' : ($priority == 2 ? 'Sedang' : 'Parah') @endphp
|
||||
<option value="{{ $priority }}">{{ $name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('is_priority') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="form-group mb-4">
|
||||
<label class="form-label mb-4">Jenis Bimbingan<sup class="text-danger">*</sup></label>
|
||||
<select name="type" class="form-select form-select-solid {{ $errors->has('type') ? 'is-invalid' : '' }}">
|
||||
@foreach ([1,2] as $priority)
|
||||
@php $name = $priority == 1 ? 'Aplikasi' : 'Face to Face' @endphp
|
||||
<option value="{{ $priority }}">{{ $name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('type') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="form-group mb-0">
|
||||
<button type="submit" class="btn btn-primary">Buat</button>
|
||||
<a href="{{ route('ticket') }}" class="btn btn-light btn-light">Kembali</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</section>
|
||||
|
||||
@push('scripts')
|
||||
<script src="https://preview.keenthemes.com/html/metronic/docs/assets/plugins/custom/ckeditor/ckeditor-classic.bundle.js"></script>
|
||||
<script>
|
||||
ClassicEditor
|
||||
.create(document.querySelector('#message'), {
|
||||
placeholder: 'Apa keluhan anda?',
|
||||
toolbar: {
|
||||
alignment: {
|
||||
options: ['left','right']
|
||||
},
|
||||
items: [
|
||||
'undo', 'redo',
|
||||
'|', 'heading',
|
||||
'|', 'bold', 'italic', 'underline', 'strikethrough',
|
||||
'|', 'link', 'insertTable',
|
||||
'|', 'bulletedList', 'numberedList', 'outdent', 'indent',
|
||||
'|', 'alignment','blockQuote',
|
||||
'|', 'horizontalLine',
|
||||
]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,81 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style>
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
width: 100%;
|
||||
border: 1px solid #000;
|
||||
font-size: 11px;
|
||||
}
|
||||
th, td {
|
||||
text-align: center;
|
||||
padding: 8px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
@page {
|
||||
margin: 0;
|
||||
}
|
||||
tr:nth-child(even){background-color: #f2f2f2}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="window.print()">
|
||||
<h2 align="center" style="margin-top: 40px; margin-bottom: 10px">Laporan Bimbingan & Konseling</h2>
|
||||
<p align="center" style="margin-bottom: 5px">Periode : {{ $periode }}</p>
|
||||
<p align="center" style="margin-bottom: 40px">Dicetak oleh : {{ Auth::user()->name }}</p>
|
||||
<table border="1">
|
||||
<tr>
|
||||
<th>TGL</th>
|
||||
<th>NO. TICKET</th>
|
||||
<th>NAMA</th>
|
||||
<th>SUBJEK</th>
|
||||
<th>TINGKAT MASALAH</th>
|
||||
<th>TIPE</th>
|
||||
<th>STATUS</th>
|
||||
</tr>
|
||||
|
||||
@if($report->count() == 0)
|
||||
<tr>
|
||||
<td colspan="7">Tidak ditemukan data pada periode {{ $periode }}</td>
|
||||
</tr>
|
||||
@else
|
||||
|
||||
@foreach($report as $detail)
|
||||
@if($detail->is_priority == 1)
|
||||
@php $priority = 'Normal' @endphp
|
||||
@elseif($detail->is_priority == 2)
|
||||
@php $priority = 'Sedang' @endphp
|
||||
@else
|
||||
@php $priority = 'Parah' @endphp
|
||||
@endif
|
||||
@if($detail->is_status == 1)
|
||||
@php $status = 'Menunggu Respon' @endphp
|
||||
@elseif($detail->is_status == 2)
|
||||
@php $status = 'Konselor telah membalas' @endphp
|
||||
@elseif($detail->is_status == 3)
|
||||
@php $status = "Siswa telah membalas" @endphp
|
||||
@else
|
||||
@php $status = 'Kasus ditutup' @endphp
|
||||
@endif
|
||||
|
||||
@if($detail->type == 1)
|
||||
@php $type = 'Aplikasi' @endphp
|
||||
@else
|
||||
@php $type = 'Face to Face' @endphp
|
||||
@endif
|
||||
<tr>
|
||||
<td>{{ $detail->created_at }}</td>
|
||||
<td>#{{ strtoupper(explode('-', $detail->id)[0]) }}</td>
|
||||
<td>{{ \App\Models\User::where('id', $detail->user_id)->first()->name }}</td>
|
||||
<td>{{ $detail->subject }}</td>
|
||||
<td>{{ $priority }}</td>
|
||||
<td>{{ $type }}</td>
|
||||
<td>{{ $status }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endempty
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,182 @@
|
|||
@include('components.theme.pages.header')
|
||||
|
||||
<section>
|
||||
<!-- basic table -->
|
||||
{{ Form::open(['route' => ['konselor.ticket.update', 'id' => $detail->id]]) }}
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<h6 class="card-title">Detail Bimbingan & Konseling</h6>
|
||||
@if($detail->is_status != 4)
|
||||
<div class="ms-auto">
|
||||
<a href="{{ route('konselor.ticket.close', ['id' => $detail->id]) }}" class="btn btn-sm btn-danger">Tutup Kasus</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="d-flex align-items-center list-group-item border-0">
|
||||
<span class="fw-bold">Nama Siswa:</span>
|
||||
<span class="ms-auto">{{ $siswa }} (NIS: {{ $nis }})</span>
|
||||
</li>
|
||||
<li class="d-flex align-items-center list-group-item border-0">
|
||||
<span class="fw-bold">Jenis Bimbingan & Konseling:</span>
|
||||
<span class="ms-auto">
|
||||
@if($detail->is_priority == 1)
|
||||
<span class="mb-1 badge font-medium bg-light-info text-info">Normal</span>
|
||||
@elseif($detail->is_priority == 2)
|
||||
<span class="mb-1 badge font-medium bg-light-primary text-primary">Sedang</span>
|
||||
@else
|
||||
<span class="mb-1 badge font-medium bg-light-danger text-danger">Parah</span>
|
||||
@endif
|
||||
</span>
|
||||
</li>
|
||||
<li class="d-flex align-items-center list-group-item border-0">
|
||||
<span class="fw-bold">Status Bimbingan & Konseling:</span>
|
||||
<span class="ms-auto">
|
||||
@if($detail->is_status == 1)
|
||||
<span class="mb-1 badge font-medium bg-light-info text-info">Menunggu Respon</span>
|
||||
@elseif($detail->is_status == 2)
|
||||
<span class="mb-1 badge font-medium bg-light-primary text-primary">Konselor telah membalas</span>
|
||||
@elseif($detail->is_status == 3)
|
||||
<span class="mb-1 badge font-medium bg-light-primary text-primary">{{ $siswa }} telah membalas</span>
|
||||
@else
|
||||
<span class="mb-1 badge font-medium bg-light-danger text-danger">Kasus ditutup</span>
|
||||
@endif
|
||||
</span>
|
||||
</li>
|
||||
<li class="d-flex align-items-center list-group-item border-0">
|
||||
<span class="fw-bold">Tanggal B.K dibuat:</span>
|
||||
<span class="ms-auto">
|
||||
{{ date_formatting($detail->created_at, 'timeago') }}
|
||||
</span>
|
||||
</li>
|
||||
<li class="d-flex align-items-center list-group-item border-0">
|
||||
<span class="fw-bold">Tanggal B.K diperbarui:</span>
|
||||
<span class="ms-auto">
|
||||
{{ date_formatting($detail->updated_at, 'timeago') }}
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 mt-5">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@if(!empty($ticketResponse))
|
||||
<div class="mb-4" style="max-height: 300px" data-simplebar>
|
||||
@foreach($ticketResponse as $record)
|
||||
@php $sender = \App\Models\User::find($record->user_id)->name @endphp
|
||||
@php $senderAvatar = substr($sender, 0, 1) @endphp
|
||||
<div class="mb-9">
|
||||
<div class="card card-bordered w-100">
|
||||
<div class="card-body">
|
||||
<div class="w-100 d-flex flex-stack mb-8">
|
||||
<div class="d-flex align-items-center f">
|
||||
<div class="symbol symbol-50px me-5">
|
||||
@if (\App\Models\User::find($record->user_id)->level == enum('isKonselor'))
|
||||
@php
|
||||
$level = "konselor";
|
||||
@endphp
|
||||
@if(empty(\App\Models\User::where('id', $record->konselor_id)->first()->thumbnail))
|
||||
<div class="symbol-label fs-1 fw-bold bg-primary text-white">
|
||||
{{ $senderAvatar }}
|
||||
</div>
|
||||
@else
|
||||
<div class="symbol symbol-50px">
|
||||
@php
|
||||
$thumbnail = \App\Models\User::where('id', $record->konselor_id)->first()->thumbnail;
|
||||
@endphp
|
||||
<img src="{{ \Storage::url($thumbnail) }}" alt="Foto Profil"/>
|
||||
</div>
|
||||
@endif
|
||||
@else
|
||||
@php
|
||||
$level = "siswa";
|
||||
@endphp
|
||||
@if(\App\Models\User::where('id', $record->user_id)->first()->thumbnail === '')
|
||||
<div class="symbol-label fs-1 fw-bold bg-primary text-white">
|
||||
{{ $senderAvatar }}
|
||||
</div>
|
||||
@else
|
||||
<div class="symbol symbol-50px">
|
||||
@php
|
||||
$thumbnail = \App\Models\User::where('id', $record->user_id)->first()->thumbnail;
|
||||
@endphp
|
||||
<img src="{{ \Storage::url($thumbnail) }}" alt="Foto Profil"/>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
<div class="d-flex flex-column fw-semibold fs-5 text-gray-600 text-dark">
|
||||
<div class="d-flex align-items-center">
|
||||
<a href="#" class="text-gray-800 fw-bold text-hover-primary fs-5 me-3">{{ $sender }} <span class="small text-muted">as {{ $level }}</small></a>
|
||||
<span class="m-0"></span>
|
||||
</div>
|
||||
<span class="text-muted fw-semibold small">{{ date_formatting($record->created_at, 'timeago') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--begin::Desc-->
|
||||
<p class="fw-normal fs-5 text-gray-700 m-0">
|
||||
{!! $record->message !!}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@else
|
||||
<div class="alert alert-danger d-flex align-items-center p-5">
|
||||
<i class="ki-duotone ki-shield-tick fs-2hx text-danger me-4"><span class="path1"></span><span class="path2"></span></i>
|
||||
<div class="d-flex flex-column">
|
||||
<h4 class="mb-1 text-danger">Maaf! Pesan tidak ditemukan</h4>
|
||||
<span>Tidak ditemukan pesan pada ticket, Silahkan kirim pesan</span>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@if($detail->is_status != 4)
|
||||
<div>
|
||||
<textarea class="form-control form-control-solid placeholder-gray-600 fw-bold fs-4 ps-9 pt-7" rows="6" name="message" placeholder="Kirim pesan" style="height: 149px;"></textarea>
|
||||
<button type="submit" class="btn btn-primary mt-n20 position-relative float-end me-7">Kirim</button>
|
||||
</div>
|
||||
@else
|
||||
<div>
|
||||
<div class="alert alert-success">Bimbingan & Konseling sudah ditutup/dinyatakan selesai!</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</section>
|
||||
|
||||
@push('scripts')
|
||||
<script src="https://preview.keenthemes.com/html/metronic/docs/assets/plugins/custom/ckeditor/ckeditor-classic.bundle.js"></script>
|
||||
<script>
|
||||
ClassicEditor
|
||||
.create(document.querySelector('#message'), {
|
||||
placeholder: 'Apa keluhan anda?',
|
||||
toolbar: {
|
||||
alignment: {
|
||||
options: ['left','right']
|
||||
},
|
||||
items: [
|
||||
'undo', 'redo',
|
||||
'|', 'heading',
|
||||
'|', 'bold', 'italic', 'underline', 'strikethrough',
|
||||
'|', 'link', 'insertTable',
|
||||
'|', 'bulletedList', 'numberedList', 'outdent', 'indent',
|
||||
'|', 'alignment','blockQuote',
|
||||
'|', 'horizontalLine',
|
||||
]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,308 @@
|
|||
@push('css')
|
||||
<link href="{{ frontend('plugins/custom/datatables/datatables.bundle.css') }}" rel="stylesheet" type="text/css" />
|
||||
@endpush
|
||||
@include('components.theme.pages.header')
|
||||
|
||||
<section>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="px-5 py-3 border rounded mb-4">
|
||||
<form method="POST" action="{{ site_url('konselor', 'ticket/cetak') }}">
|
||||
@csrf
|
||||
<h2>Filter</h2>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col d-flex">
|
||||
<input type="date" id="start_date" name="start_date" class="form-control form-control-solid w-200px ps-15"/>
|
||||
<input type="date" id="end_date" name="end_date" class="form-control form-control-solid w-200px ps-15 ms-2"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
<div class="col d-flex">
|
||||
<select id="subjek" name="type" class="form-select form-select-solid w-200px ps-15">
|
||||
<option value="">Pilih Subjek</option>
|
||||
<option value="Non Akademis">Non Akademis</option>
|
||||
<option value="Akademis">Akademis</option>
|
||||
<option value="Masuk Universitas">Masuk Universitas</option>
|
||||
<option value="Masalah Keluarga">Masalah Keluarga</option>
|
||||
<option value="Yang Lain">Yang Lain</option>
|
||||
</select>
|
||||
<select id="jenis" name="jenis" class="form-select form-select-solid w-200px ps-15 ms-2">
|
||||
<option value="">Pilih Jenis</option>
|
||||
<option value="2">Face to Face</option>
|
||||
<option value="1">Aplikasi</option>
|
||||
</select>
|
||||
<select id="status" name="status" class="form-select form-select-solid w-200px ps-15 ms-2">
|
||||
<option value="">Pilih Status</option>
|
||||
<option value="1">Menunggu Respon</option>
|
||||
<option value="2">User Telah Membalas</option>
|
||||
<option value="3">Admin/Wali telah membalas</option>
|
||||
<option value="4">Kasus ditutup</option>
|
||||
</select>
|
||||
<select id="kasus" name="kasus" class="form-select form-select-solid w-200px ps-15 ms-2">
|
||||
<option value="">Pilih Kasus</option>
|
||||
<option value="1">Normal</option>
|
||||
<option value="2">Sedang</option>
|
||||
<option value="3">Parah</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<div class="col d-flex justify-content-end">
|
||||
<a id="btnTerapkan" class="btn btn-light btn-active-light-primary me-2">Terapkan</a>
|
||||
<button type="submit" class="btn btn-primary">Cetak</button/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- basic table -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card card-flush">
|
||||
<div class="card-header flex-nowrap pt-5">
|
||||
<div>
|
||||
<div class="d-flex align-items-center position-relative my-1">
|
||||
<i class="ki-outline ki-magnifier fs-1 position-absolute ms-6"><span class="path1"></span><span class="path2"></span></i>
|
||||
<input type="text" id="search" class="form-control form-control-solid w-250px ps-15" placeholder="Cari Bimbingan & Konseling"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-toolbar">
|
||||
<!--begin::Menu-->
|
||||
{{-- <button class="btn btn-light-primary btn-active-light-primary justify-content-end"
|
||||
data-kt-menu-trigger="click" data-kt-menu-placement="bottom-end"
|
||||
data-kt-menu-overflow="true">
|
||||
<i class="ki-outline ki-filter fs-1 me-n1"></i>
|
||||
<span class="mb-0">Filter</span>
|
||||
</button> --}}
|
||||
|
||||
<div class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-800 menu-state-bg-light-primary fw-semibold w-300px"
|
||||
data-kt-menu="true">
|
||||
<div class="menu-item px-3">
|
||||
<div class="menu-content fs-6 text-dark fw-bold px-3 py-4">Filter By</div>
|
||||
</div>
|
||||
<div class="separator mb-3 opacity-75"></div>
|
||||
<div class="menu-item px-3" data-kt-docs-table-filter="status_type">
|
||||
<div class="form-check mb-4">
|
||||
<input class="form-check-input" name="status" type="radio" value="" id="flexCheckDefault" />
|
||||
<label class="form-check-label" for="flexCheckDefault">
|
||||
All
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check mb-4">
|
||||
<input class="form-check-input" name="status" type="radio" value="1" id="flexCheckDefault" />
|
||||
<label class="form-check-label" for="flexCheckDefault">
|
||||
Menunggu Respon
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check mb-4">
|
||||
<input class="form-check-input" name="status" type="radio" value="2" id="flexCheckDefault" />
|
||||
<label class="form-check-label" for="flexCheckDefault">
|
||||
User telah membalas
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check mb-4">
|
||||
<input class="form-check-input" name="status" type="radio" value="3" id="flexCheckDefault" />
|
||||
<label class="form-check-label" for="flexCheckDefault">
|
||||
Admin/Wali telah membalas
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check mb-4">
|
||||
<input class="form-check-input" name="status" type="radio" value="4" id="flexCheckDefault" />
|
||||
<label class="form-check-label" for="flexCheckDefault">
|
||||
Kasus ditutup
|
||||
</label>
|
||||
</div>
|
||||
<div class="d-flex justify-content-end py-3">
|
||||
<button type="reset" class="btn btn-light btn-active-light-primary me-2" data-kt-menu-dismiss="true" data-kt-docs-table-filter="reset">Atur Ulang</button>
|
||||
<button type="submit" class="btn btn-primary" data-kt-menu-dismiss="true" data-kt-docs-table-filter="filter">Terapkan</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="data-table" class="table align-middle table-row-dashed fs-6 gy-5">
|
||||
<thead>
|
||||
<tr class="text-start text-gray-400 fw-bold fs-7 text-uppercase gs-0">
|
||||
<th>ID</th>
|
||||
<th>Subjek</th>
|
||||
<th>Siswa</th>
|
||||
<th>Jenis B.K</th>
|
||||
<th>Status</th>
|
||||
<th>Status Approval</th>
|
||||
<th>Kasus</th>
|
||||
<th>Created</th>
|
||||
<th>Chat</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-gray-600 fw-semibold"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ frontend('plugins/custom/datatables/datatables.bundle.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var table = $('#data-table').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: "{{ site_url('konselor', 'ticket') }}",
|
||||
order: [[5, 'desc']],
|
||||
stateSave: true,
|
||||
columns: [
|
||||
{data: null, name: 'id'},
|
||||
{data: 'title-post', name: 'title-post'},
|
||||
{data: 'siswa', name: 'siswa'},
|
||||
{data: 'jenis', name: 'jenis'},
|
||||
{data: 'status', name: 'status'},
|
||||
{data: 'approval', name: 'approval', orderable: false, searchable: false},
|
||||
{data: 'priority', name: 'priority'},
|
||||
{data: 'created_at', name: 'created_at'},
|
||||
{data: null, name: null, orderable: false, searchable: false},
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
targets: -1,
|
||||
data: null,
|
||||
orderable: false,
|
||||
render: function (data, type, row) {
|
||||
|
||||
let text = ``;
|
||||
|
||||
if(row.is_approval_konselor == 3) {
|
||||
text += `
|
||||
<div class="menu-item px-3">
|
||||
<a href="{{ site_url('konselor', 'ticket/accept') }}/${row.id}" class="menu-link px-3" data-kt-docs-table-filter="delete_row">
|
||||
Terima Permintaan
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="menu-item px-3">
|
||||
<a href="{{ site_url('konselor', 'ticket/declined') }}/${row.id}" class="menu-link px-3" data-kt-docs-table-filter="delete_row">
|
||||
Tolak Permintaan
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
return `
|
||||
<a href="#" class="btn btn-light btn-active-light-primary btn-sm" data-kt-menu-trigger="click" data-kt-menu-placement="bottom-end" data-kt-menu-flip="top-end">
|
||||
Aksi
|
||||
</a>
|
||||
<!--begin::Menu-->
|
||||
<div class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-600 menu-state-bg-light-primary fw-bold fs-7 w-125px py-4" data-kt-menu="true">
|
||||
<div class="menu-item px-3">
|
||||
<a href="{{ site_url('konselor', 'ticket/view') }}/${row.id}" class="menu-link px-3" data-kt-docs-table-filter="delete_row">
|
||||
Lihat Pesan
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!--begin::Menu item-->
|
||||
<div class="menu-item px-3">
|
||||
<a href="#" data-url="{{ site_url('konselor', 'ticket/delete') }}/${row.id}" class="menu-link px-3 deleteContent">
|
||||
Hapus Aduan
|
||||
</a>
|
||||
</div>
|
||||
<!--end::Menu item-->
|
||||
|
||||
${text}
|
||||
</div>
|
||||
<!--end::Menu-->
|
||||
`;
|
||||
},
|
||||
}
|
||||
],
|
||||
createdRow: function (row, data, dataIndex) {
|
||||
// Set the sequential number starting from 1
|
||||
$('td', row).eq(0).html(dataIndex + 1);
|
||||
}
|
||||
});
|
||||
|
||||
// Filter Datatable
|
||||
var handleFilterDatatable = () => {
|
||||
// Select filter options
|
||||
filterStatus = document.querySelectorAll('[data-kt-docs-table-filter="status_type"] [name="status"]');
|
||||
const filterButton = document.querySelector('[data-kt-docs-table-filter="filter"]');
|
||||
|
||||
$('#btnTerapkan').on('click', function(e) {
|
||||
var startDate = $('#start_date').val();
|
||||
var endDate = $('#end_date').val();
|
||||
var subjek = $('#subjek').val();
|
||||
var jenis = $('#jenis').val();
|
||||
var status = $('#status').val();
|
||||
var kasus = $('#kasus').val();
|
||||
|
||||
var filterParams = {
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
subjek: subjek,
|
||||
jenis: jenis,
|
||||
status: status,
|
||||
kasus: kasus
|
||||
};
|
||||
|
||||
table.search(JSON.stringify(filterParams)).draw();
|
||||
});
|
||||
|
||||
// Filter datatable on submit
|
||||
filterButton.addEventListener('click', function () {
|
||||
let statusValue = 'status|';
|
||||
filterStatus.forEach(r => {
|
||||
if (r.checked) {
|
||||
statusValue = 'status|' + r.value;
|
||||
}
|
||||
|
||||
if (statusValue === 'status|') {
|
||||
statusValue = 'status|';
|
||||
}
|
||||
});
|
||||
|
||||
table.search(statusValue).draw();
|
||||
});
|
||||
}
|
||||
|
||||
// Reset Filter
|
||||
var handleResetForm = () => {
|
||||
const resetButton = document.querySelector('[data-kt-docs-table-filter="reset"]');
|
||||
resetButton.addEventListener('click', function () {
|
||||
filterStatus[0].checked = true;
|
||||
table.search('').draw();
|
||||
});
|
||||
}
|
||||
|
||||
table.on('draw', function () {
|
||||
handleFilterDatatable();
|
||||
handleResetForm();
|
||||
KTMenu.createInstances();
|
||||
});
|
||||
|
||||
table.search('').draw();
|
||||
|
||||
// #myInput is a <input type="text"> element
|
||||
$('#search').on('keyup change', function () {
|
||||
table.search('user|' + this.value).draw();
|
||||
});
|
||||
|
||||
$('#data-table').on('click', '.deleteContent', function() {
|
||||
var url = $(this).data('url');
|
||||
$('#exampleModal').modal('show', {
|
||||
backdrop: 'static'
|
||||
});
|
||||
$('.link').attr('href', url)
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,87 @@
|
|||
@include('components.theme.pages.header')
|
||||
|
||||
<section>
|
||||
<!-- basic table -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
{{ Form::open(['route' => 'konselor.wali.store']) }}
|
||||
@csrf
|
||||
<div class="row mb-4">
|
||||
<div class="col">
|
||||
<label class="form-label">Alamat Email<sup class="text-danger">*</sup></label>
|
||||
<input type="email" name="email" value="{{ old('email') }}" autocomplete="off" class="form-control form-control-solid mt-2 {{ $errors->has('email') ? 'is-invalid' : '' }}" placeholder="Enter Email Address">
|
||||
@error('email') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-label">Nama Lengkap<sup class="text-danger">*</sup></label>
|
||||
<input type="text" name="name" value="{{ old('name') }}" autocomplete="off" class="form-control form-control-solid mt-2 {{ $errors->has('name') ? 'is-invalid' : '' }}" placeholder="Enter Name">
|
||||
@error('name') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-4" data-kt-password-meter="true">
|
||||
<label class="form-label">Password<sup class="text-danger">*</sup></label>
|
||||
<div class="position-relative mb-3">
|
||||
<input class="form-control form-control-lg form-control-solid mt-2 {{ $errors->has('password') ? 'is-invalid' : '' }}"
|
||||
type="password" value="{{ old('password') }}" placeholder="Enter Password" name="password" autocomplete="off" />
|
||||
|
||||
<!--begin::Visibility toggle-->
|
||||
<span class="btn btn-sm btn-icon position-absolute translate-middle top-50 end-0 me-n2"
|
||||
data-kt-password-meter-control="visibility">
|
||||
<i class="ki-duotone ki-eye-slash fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span><span class="path4"></span></i>
|
||||
<i class="ki-duotone ki-eye d-none fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span></i>
|
||||
</span>
|
||||
<!--end::Visibility toggle-->
|
||||
</div>
|
||||
|
||||
<!--begin::Highlight meter-->
|
||||
<div class="d-flex align-items-center mb-3" data-kt-password-meter-control="highlight">
|
||||
<div class="flex-grow-1 bg-secondary bg-active-success rounded h-5px me-2"></div>
|
||||
<div class="flex-grow-1 bg-secondary bg-active-success rounded h-5px me-2"></div>
|
||||
<div class="flex-grow-1 bg-secondary bg-active-success rounded h-5px me-2"></div>
|
||||
<div class="flex-grow-1 bg-secondary bg-active-success rounded h-5px"></div>
|
||||
</div>
|
||||
|
||||
@error('password') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
<div class="text-muted">
|
||||
Use 8 or more characters with a mix of letters, numbers & symbols.
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-4">
|
||||
<div class="col">
|
||||
<label class="form-label">Atur Siswa<sup class="text-danger">*</sup></label>
|
||||
<select name="siswa_id" data-control="select2" class="form-select form-select-solid mt-2 {{ $errors->has('siswa_id') ? 'is-invalid' : '' }}">
|
||||
@foreach ($getListSiswa as $siswa)
|
||||
<option value="{{ $siswa->id }}">{{ $siswa->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('siswa_id') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-label">Status Account<sup class="text-danger">*</sup></label>
|
||||
<select name="status" class="form-select form-select-solid mt-2 {{ $errors->has('status') ? 'is-invalid' : '' }}">
|
||||
@foreach ([1,2,3,4] as $rolez)
|
||||
@php $name = $rolez == 1 ? 'Active' : ($rolez == 2 ? 'Non Active' : ($rolez == 3 ? 'Deactivated' : 'Not Verified')) @endphp
|
||||
<option value="{{ $rolez }}">{{ $name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('status') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group mb-0">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<a href="{{ route('konselor.wali') }}" class="btn btn-light btn-light">Back</a>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@push('scripts')
|
||||
|
||||
@endpush
|
||||
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,88 @@
|
|||
@include('components.theme.pages.header')
|
||||
|
||||
<section>
|
||||
<!-- basic table -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
{{ Form::open(['route' => ['konselor.wali.update', 'id' => $id]]) }}
|
||||
@csrf
|
||||
<div class="row mb-4">
|
||||
<div class="col">
|
||||
<label class="form-label">Alamat Email<sup class="text-danger">*</sup></label>
|
||||
<input type="email" name="email" value="{{ $data['records']['email'] }}" autocomplete="off" class="form-control form-control-solid mt-2 {{ $errors->has('email') ? 'is-invalid' : '' }}" placeholder="Enter Email Address">
|
||||
@error('email') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-label">Nama Lengkap<sup class="text-danger">*</sup></label>
|
||||
<input type="text" name="name" value="{{ $data['records']['name'] }}" autocomplete="off" class="form-control form-control-solid mt-2 {{ $errors->has('name') ? 'is-invalid' : '' }}" placeholder="Enter Name">
|
||||
@error('name') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-4" data-kt-password-meter="true">
|
||||
<label class="form-label">Password<sup class="text-danger">*</sup></label>
|
||||
<div class="position-relative mb-3">
|
||||
<input class="form-control form-control-lg form-control-solid mt-2 {{ $errors->has('password') ? 'is-invalid' : '' }}"
|
||||
type="password" value="{{ old('password') }}" placeholder="Enter Password" name="password" autocomplete="off" />
|
||||
|
||||
<!--begin::Visibility toggle-->
|
||||
<span class="btn btn-sm btn-icon position-absolute translate-middle top-50 end-0 me-n2"
|
||||
data-kt-password-meter-control="visibility">
|
||||
<i class="ki-duotone ki-eye-slash fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span><span class="path4"></span></i>
|
||||
<i class="ki-duotone ki-eye d-none fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span></i>
|
||||
</span>
|
||||
<!--end::Visibility toggle-->
|
||||
</div>
|
||||
|
||||
<!--begin::Highlight meter-->
|
||||
<div class="d-flex align-items-center mb-3" data-kt-password-meter-control="highlight">
|
||||
<div class="flex-grow-1 bg-secondary bg-active-success rounded h-5px me-2"></div>
|
||||
<div class="flex-grow-1 bg-secondary bg-active-success rounded h-5px me-2"></div>
|
||||
<div class="flex-grow-1 bg-secondary bg-active-success rounded h-5px me-2"></div>
|
||||
<div class="flex-grow-1 bg-secondary bg-active-success rounded h-5px"></div>
|
||||
</div>
|
||||
|
||||
@error('password') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
<div class="text-muted">
|
||||
Use 8 or more characters with a mix of letters, numbers & symbols.
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-4">
|
||||
<div class="col">
|
||||
<label class="form-label">Atur Siswa<sup class="text-danger">*</sup></label>
|
||||
<select name="siswa_id" data-control="select2" class="form-select form-select-solid mt-2 {{ $errors->has('siswa_id') ? 'is-invalid' : '' }}">
|
||||
@foreach ($getListSiswa as $siswa)
|
||||
@php $selected = $detailSiswa->siswa_id == $siswa->id ? 'selected' : '' @endphp
|
||||
<option value="{{ $siswa->id }}" {{ $selected }}>{{ $siswa->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('siswa_id') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-label">Status Account<sup class="text-danger">*</sup></label>
|
||||
<select name="status" class="form-select form-select-solid mt-2 {{ $errors->has('status') ? 'is-invalid' : '' }}">
|
||||
@foreach ([1,2,3,4] as $rolez)
|
||||
@php $name = $rolez == 1 ? 'Active' : ($rolez == 2 ? 'Non Active' : ($rolez == 3 ? 'Deactivated' : 'Not Verified')) @endphp
|
||||
<option value="{{ $rolez }}">{{ $name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('status') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group mb-0">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<a href="{{ route('konselor.wali') }}" class="btn btn-light btn-light">Back</a>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@push('scripts')
|
||||
|
||||
@endpush
|
||||
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,208 @@
|
|||
@push('css')
|
||||
<link href="{{ frontend('plugins/custom/datatables/datatables.bundle.css') }}" rel="stylesheet" type="text/css" />
|
||||
@endpush
|
||||
@include('components.theme.pages.header')
|
||||
|
||||
<section>
|
||||
<!-- basic table -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card card-flush">
|
||||
<div class="card-header flex-nowrap pt-5">
|
||||
<div>
|
||||
<div class="d-flex align-items-center position-relative my-1">
|
||||
<i class="ki-outline ki-magnifier fs-1 position-absolute ms-6"><span class="path1"></span><span class="path2"></span></i>
|
||||
<input type="text" id="search" class="form-control form-control-solid w-250px ps-15" placeholder="Search User"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-toolbar">
|
||||
<!--begin::Menu-->
|
||||
<button class="btn btn-light-primary btn-active-light-primary justify-content-end"
|
||||
data-kt-menu-trigger="click" data-kt-menu-placement="bottom-end"
|
||||
data-kt-menu-overflow="true">
|
||||
<i class="ki-outline ki-filter fs-1 me-n1"></i>
|
||||
<span class="mb-0">Filter</span>
|
||||
</button>
|
||||
|
||||
<div class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-800 menu-state-bg-light-primary fw-semibold w-300px"
|
||||
data-kt-menu="true">
|
||||
<div class="menu-item px-3">
|
||||
<div class="menu-content fs-6 text-dark fw-bold px-3 py-4">Filter By</div>
|
||||
</div>
|
||||
<div class="separator mb-3 opacity-75"></div>
|
||||
<div class="menu-item px-3" data-kt-docs-table-filter="status_type">
|
||||
<div class="form-check mb-4">
|
||||
<input class="form-check-input" name="status" type="checkbox" value="1" id="flexCheckDefault" />
|
||||
<label class="form-check-label" for="flexCheckDefault">
|
||||
All
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check mb-4">
|
||||
<input class="form-check-input" name="status" type="checkbox" value="2" id="flexCheckDefault" />
|
||||
<label class="form-check-label" for="flexCheckDefault">
|
||||
Active
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check mb-4">
|
||||
<input class="form-check-input" name="status" type="checkbox" value="3" id="flexCheckDefault" />
|
||||
<label class="form-check-label" for="flexCheckDefault">
|
||||
Non Active
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check mb-4">
|
||||
<input class="form-check-input" name="status" type="checkbox" value="4" id="flexCheckDefault" />
|
||||
<label class="form-check-label" for="flexCheckDefault">
|
||||
Deactivated
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check mb-4">
|
||||
<input class="form-check-input" name="status" type="checkbox" value="5" id="flexCheckDefault" />
|
||||
<label class="form-check-label" for="flexCheckDefault">
|
||||
Not Verified
|
||||
</label>
|
||||
</div>
|
||||
<div class="d-flex justify-content-end py-3">
|
||||
<button type="reset" class="btn btn-light btn-active-light-primary me-2" data-kt-menu-dismiss="true" data-kt-docs-table-filter="reset">Atur Ulang</button>
|
||||
<button type="submit" class="btn btn-primary" data-kt-menu-dismiss="true" data-kt-docs-table-filter="filter">Terapkan</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="data-table" class="table align-middle table-row-dashed fs-6 gy-5">
|
||||
<thead>
|
||||
<tr class="text-start text-gray-400 fw-bold fs-7 text-uppercase gs-0">
|
||||
<th>ID</th>
|
||||
<th>Nama Orang Tua</th>
|
||||
<th>Nama Siswa</th>
|
||||
<th>Email Address</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-gray-600 fw-semibold"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ frontend('plugins/custom/datatables/datatables.bundle.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var filterStatus;
|
||||
|
||||
var table = $('#data-table').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: "{{ route('konselor.wali') }}",
|
||||
order: [[1, 'desc']],
|
||||
stateSave: true,
|
||||
columns: [
|
||||
{data: null, name: 'id'},
|
||||
{data: 'title-post', name: 'title-post'},
|
||||
{data: 'siswa', name: 'siswa'},
|
||||
{data: 'email', name: 'email'},
|
||||
{data: 'status', name: 'status'},
|
||||
{data: null},
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
targets: -1,
|
||||
data: null,
|
||||
orderable: false,
|
||||
render: function (data, type, row) {
|
||||
return `
|
||||
<a href="#" class="btn btn-light btn-active-light-primary btn-sm" data-kt-menu-trigger="click" data-kt-menu-placement="bottom-end" data-kt-menu-flip="top-end">
|
||||
Aksi
|
||||
</a>
|
||||
<!--begin::Menu-->
|
||||
<div class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-600 menu-state-bg-light-primary fw-bold fs-7 w-125px py-4" data-kt-menu="true">
|
||||
<div class="menu-item px-3">
|
||||
<a href="{{ site_url('konselor', 'wali/edit') }}/${row.id}" class="menu-link px-3" data-kt-docs-table-filter="delete_row">
|
||||
Edit
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!--begin::Menu item-->
|
||||
<div class="menu-item px-3">
|
||||
<a href="#" data-url="{{ site_url('konselor', 'wali/delete') }}/${row.id}" class="menu-link px-3 deleteContent">
|
||||
Delete
|
||||
</a>
|
||||
</div>
|
||||
<!--end::Menu item-->
|
||||
</div>
|
||||
<!--end::Menu-->
|
||||
`;
|
||||
},
|
||||
}
|
||||
],
|
||||
createdRow: function (row, data, dataIndex) {
|
||||
// Set the sequential number starting from 1
|
||||
$('td', row).eq(0).html(dataIndex + 1);
|
||||
}
|
||||
});
|
||||
|
||||
// Filter Datatable
|
||||
var handleFilterDatatable = () => {
|
||||
// Select filter options
|
||||
filterStatus = document.querySelectorAll('[data-kt-docs-table-filter="status_type"] [name="status"]');
|
||||
const filterButton = document.querySelector('[data-kt-docs-table-filter="filter"]');
|
||||
|
||||
// Filter datatable on submit
|
||||
filterButton.addEventListener('click', function () {
|
||||
let statusValue = 'status|';
|
||||
filterStatus.forEach(r => {
|
||||
if (r.checked) {
|
||||
statusValue = 'status|' + r.value;
|
||||
}
|
||||
|
||||
if (statusValue === 'status|') {
|
||||
statusValue = 'status|';
|
||||
}
|
||||
});
|
||||
|
||||
table.search(statusValue).draw();
|
||||
});
|
||||
}
|
||||
|
||||
// Reset Filter
|
||||
var handleResetForm = () => {
|
||||
const resetButton = document.querySelector('[data-kt-docs-table-filter="reset"]');
|
||||
resetButton.addEventListener('click', function () {
|
||||
filterStatus[0].checked = true;
|
||||
table.search('').draw();
|
||||
});
|
||||
}
|
||||
|
||||
table.on('draw', function () {
|
||||
handleFilterDatatable();
|
||||
handleResetForm();
|
||||
KTMenu.createInstances();
|
||||
});
|
||||
|
||||
table.search('').draw();
|
||||
|
||||
// #myInput is a <input type="text"> element
|
||||
$('#search').on('keyup change', function () {
|
||||
table.search('user|' + this.value).draw();
|
||||
});
|
||||
|
||||
$('#data-table').on('click', '.deleteContent', function() {
|
||||
var url = $(this).data('url');
|
||||
$('#exampleModal').modal('show', {
|
||||
backdrop: 'static'
|
||||
});
|
||||
$('.link').attr('href', url)
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register API routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| is assigned the "api" middleware group. Enjoy building your API!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::middleware('auth:api')->get('/konselor', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
Route::group(['prefix' => 'konselor', 'middleware' => ['auth']], function () {
|
||||
Route::get('/', 'KonselorController@index');
|
||||
Route::get('profil', 'KonselorController@profil')->name('konselor.account');
|
||||
Route::post('update', 'KonselorController@update')->name('konselor.update');
|
||||
|
||||
|
||||
Route::prefix('ticket')->group(function() {
|
||||
Route::get('/', 'TicketController@index')->name('konselor.ticket');
|
||||
Route::get('create', 'TicketController@create')->name('konselor.ticket.create');
|
||||
Route::post('store', 'TicketController@store')->name('konselor.ticket.store')->middleware('XssSanitization');
|
||||
Route::post('update/{id}', 'TicketController@update')->name('konselor.ticket.update');
|
||||
Route::get('view/{id}', 'TicketController@view')->name('konselor.ticket.detail');
|
||||
Route::get('delete/{id}', 'TicketController@delete')->name('konselor.ticket.delete');
|
||||
Route::get('close/{id}', 'TicketController@closed')->name('konselor.ticket.close');
|
||||
Route::get('accept/{id}', 'TicketController@accept')->name('konselor.ticket.accept');
|
||||
Route::get('declined/{id}', 'TicketController@decline')->name('konselor.ticket.decline');
|
||||
Route::post('cetak', 'TicketController@cetak')->name('konselor.ticket.cetak');
|
||||
});
|
||||
|
||||
Route::prefix('wali')->group(function () {
|
||||
Route::get('/', 'WaliController@index')->name('konselor.wali');
|
||||
Route::get('create', 'WaliController@create')->name('konselor.wali.create');
|
||||
Route::post('store', 'WaliController@store')->name('konselor.wali.store');
|
||||
Route::get('edit/{id}', 'WaliController@edit')->name('konselor.wali.edit');
|
||||
Route::post('update/{id}', 'WaliController@update')->name('konselor.wali.update');
|
||||
Route::get('delete/{id}', 'WaliController@delete')->name('konselor.wali.delete');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "nwidart/konselor",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Konselor\\": ""
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "Konselor",
|
||||
"alias": "konselor",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Konselor\\Providers\\KonselorServiceProvider"
|
||||
],
|
||||
"aliases": {},
|
||||
"files": [],
|
||||
"requires": []
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "npm run development",
|
||||
"development": "mix",
|
||||
"watch": "mix watch",
|
||||
"watch-poll": "mix watch -- --watch-options-poll=1000",
|
||||
"hot": "mix watch --hot",
|
||||
"prod": "npm run production",
|
||||
"production": "mix --production"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^0.21.4",
|
||||
"dotenv": "^10.0.0",
|
||||
"dotenv-expand": "^5.1.0",
|
||||
"laravel-mix": "^6.0.31",
|
||||
"laravel-mix-merge-manifest": "^2.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"postcss": "^8.3.7"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
const dotenvExpand = require('dotenv-expand');
|
||||
dotenvExpand(require('dotenv').config({ path: '../../.env'/*, debug: true*/}));
|
||||
|
||||
const mix = require('laravel-mix');
|
||||
require('laravel-mix-merge-manifest');
|
||||
|
||||
mix.setPublicPath('../../public').mergeManifest();
|
||||
|
||||
mix.js(__dirname + '/Resources/assets/js/app.js', 'js/konselor.js')
|
||||
.sass( __dirname + '/Resources/assets/sass/app.scss', 'css/konselor.css');
|
||||
|
||||
if (mix.inProduction()) {
|
||||
mix.version();
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Seller'
|
||||
];
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SellerDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Model::unguard();
|
||||
|
||||
// $this->call("OthersTableSeeder");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class AccountModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_users';
|
||||
protected $fillable = ['id','password','username','name','email','email_verified_token','email_verified_at','phone','income','balance','campaign','remember_token','is_close_guide','is_buzzer','thumbnail','level', 'is_buzzer_gender', 'is_advertiser'];
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
public $timestamps = false;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class BillingModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_billing';
|
||||
protected $fillable = [
|
||||
'id', 'invoice_id', 'user_id'
|
||||
];
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
public $timestamps = false;
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class DomainModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_digital_domain';
|
||||
protected $fillable = [
|
||||
'id', 'user_id', 'url', 'is_url_from_website','is_price',
|
||||
'is_delivery_time','is_page_authority', 'is_temporary_url',
|
||||
'is_domain_authority', 'is_status', 'created_at', 'updated_at', 'is_type_product'
|
||||
];
|
||||
protected $hidden = [
|
||||
'created_at', 'updated_at',
|
||||
];
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasMany(AccountModel::class, 'id', 'user_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class NotificationModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_notifications';
|
||||
protected $primaryKey = 'uid';
|
||||
protected $fillable = [
|
||||
'uid', 'user_id', 'notifyAs',
|
||||
'onUpdateProduct', 'onUpdateNews',
|
||||
'onUpdateOrders', 'created_at', 'updated_at'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at', 'updated_at'
|
||||
];
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class NotifyModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [];
|
||||
|
||||
protected static function newFactory()
|
||||
{
|
||||
return \Modules\Seller\Database\factories\NotifyModelFactory::new();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Carbon\Carbon;
|
||||
use Modules\Seller\Entities\AccountModel;
|
||||
|
||||
class PaymentModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_deposit';
|
||||
protected $fillable = [
|
||||
'id', 'user_id', 'deposit_number', 'payment_method',
|
||||
'methodWith', 'amount', 'processing_fee', 'total',
|
||||
'is_status', 'created_at', 'updated_at', 'urlRedirect',
|
||||
'is_reference'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at', 'updated_at'
|
||||
];
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
|
||||
public function getCreatedAtAttribute($value)
|
||||
{
|
||||
return Carbon::parse($value)->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasMany(AccountModel::class, 'id', 'user_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Carbon\Carbon;
|
||||
|
||||
// model binding
|
||||
use Modules\Seller\Entities\ProductBuzzerServices;
|
||||
|
||||
class ProductBuzzer extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_product_buzzer_product';
|
||||
protected $fillable = [
|
||||
'id', 'id_services', 'name', 'icon',
|
||||
'is_active', 'created_at', 'updated_at'
|
||||
];
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
|
||||
public function productService()
|
||||
{
|
||||
return $this->hasMany(ProductBuzzerServices::class, 'id', 'id_services');
|
||||
}
|
||||
|
||||
public function getCreatedAtAttribute($value)
|
||||
{
|
||||
return Carbon::parse($value)->format('Y-m-d H:i:s');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ProductBuzzerComment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_product_buzzer_comment';
|
||||
protected $fillable = [
|
||||
'id', 'id_buzzer', 'id_user',
|
||||
'comment', 'created_at', 'updated_at'
|
||||
];
|
||||
|
||||
protected $hidden = ['created_at', 'updated_at'];
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
|
||||
public function getCreatedAtAttribute($value)
|
||||
{
|
||||
return Carbon::parse($value)->format('Y-m-d H:i:s');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Carbon\Carbon;
|
||||
|
||||
// model binding
|
||||
use Modules\Seller\Entities\ProductBuzzerServices as Services;
|
||||
use Modules\Seller\Entities\ProductBuzzer as Product;
|
||||
use Modules\Seller\Entities\ProductBuzzerComment as Comment;
|
||||
use Modules\Seller\Entities\AccountModel as Account;
|
||||
use App\Models\Website;
|
||||
|
||||
class ProductBuzzerOrder extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_product_buzzer_order';
|
||||
protected $fillable = [
|
||||
'id', 'id_product', 'id_user', 'id_media', 'url', 'is_note',
|
||||
'id_package', 'is_price', 'is_spesific_coment',
|
||||
'is_status', 'created_at', 'updated_at'
|
||||
];
|
||||
|
||||
protected $hidden = ['created_at', 'updated_at'];
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
|
||||
public function getCreatedAtAttribute($value)
|
||||
{
|
||||
return Carbon::parse($value)->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
public function services()
|
||||
{
|
||||
return $this->hasMany(Services::class, 'id', 'id_product');
|
||||
}
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->hasMany(Product::class, 'id', 'id_media');
|
||||
}
|
||||
|
||||
public function comment()
|
||||
{
|
||||
return $this->hasMany(Comment::class, 'id_buzzer', 'id');
|
||||
}
|
||||
|
||||
public function packages()
|
||||
{
|
||||
return $this->hasMany(Website::class, 'id', 'id_package');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasMany(Account::class, 'id', 'id_user');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ProductBuzzerServices extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_product_buzzer_services';
|
||||
protected $fillable = [
|
||||
'id', 'name', 'is_status', 'is_buzzer_get',
|
||||
'created_at', 'updated_at'
|
||||
];
|
||||
|
||||
protected $hidden = ['created_at', 'updated_at'];
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
|
||||
public function getCreatedAtAttribute($value)
|
||||
{
|
||||
return Carbon::parse($value)->format('Y-m-d H:i:s');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class RekeningBankModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_rekeningbank';
|
||||
protected $fillable = ['id', 'nama', 'kodebank'];
|
||||
protected $hidden = ['id', 'kodebank'];
|
||||
|
||||
public $timestamps = false;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class RekeningBuzzerModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_rekening_buzzer';
|
||||
protected $fillable = ['id', 'rid', 'account_number', 'is_active',
|
||||
'created_at', 'updated_at', 'user_id', 'name'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at', 'updated_at'
|
||||
];
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class RekeningModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_rekening';
|
||||
protected $fillable = ['id', 'rid', 'account_number', 'is_active',
|
||||
'created_at', 'updated_at', 'user_id', 'name'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at', 'updated_at'
|
||||
];
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class SitesCategoryModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_digital_website_category';
|
||||
protected $fillable = ['id', 'name', 'alias', 'is_active'];
|
||||
protected $hidden = ['created_at', 'updated_at'];
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Seller\Entities\DomainModel;
|
||||
|
||||
class SitesModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_digital_website';
|
||||
protected $fillable = [
|
||||
'id', 'user_id', 'url', 'description', 'is_role', 'is_type', 'is_language', 'is_post_price', 'is_url_category',
|
||||
'is_delivery_time', 'is_content_included', 'is_content_price', 'is_word_limit', 'is_post_sample', 'is_page_authority',
|
||||
'is_domain_authority', 'is_status', 'is_premium', 'created_at', 'updated_at', 'is_type_product', 'is_temporary_url'
|
||||
];
|
||||
protected $hidden = [
|
||||
'created_at', 'updated_at',
|
||||
];
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasMany(AccountModel::class, 'id', 'user_id');
|
||||
}
|
||||
|
||||
public static function getAllProduct()
|
||||
{
|
||||
$websites = self::where('is_status', 1)->select('id', 'url', 'is_post_price as price', 'is_delivery_time', 'is_type_product')->paginate($this->perPage)->get();
|
||||
$domain = DomainModel::where('is_status', 1)->select('id', 'url', 'is_price as price', 'is_delivery_time', 'is_type_product')->paginate($this->perPage)->get();
|
||||
|
||||
return $websites->merge($domain);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class TicketModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_ticket';
|
||||
protected $fillable = [
|
||||
'id', 'user_id', 'subject', 'konselor_id',
|
||||
'is_priority', 'is_status',
|
||||
'created_at', 'updated_at',
|
||||
'senderAs', 'type', 'meet_at'
|
||||
];
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
|
||||
public function responses()
|
||||
{
|
||||
return $this->hasMany(TicketResponseModel::class, 'id_ticket')->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
public function getCreatedAtAttribute($value)
|
||||
{
|
||||
return Carbon::parse($value)->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasMany(AccountModel::class, 'id', 'user_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class TicketResponseModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_ticket_reply';
|
||||
protected $fillable = [
|
||||
'id', 'id_ticket', 'user_id',
|
||||
'message', 'created_at',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at'
|
||||
];
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
public $timestamps = false;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class WithdrawalBuzzerModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_withdrawal_campaign';
|
||||
protected $fillable = [
|
||||
'id', 'user_id', 'amount', 'is_status', 'is_account',
|
||||
'created_at', 'updated_at', 'invoice_id'
|
||||
];
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasMany(AccountModel::class, 'id', 'user_id');
|
||||
}
|
||||
|
||||
public function rekening()
|
||||
{
|
||||
return $this->hasMany(RekeningModel::class, 'id', 'is_account');
|
||||
}
|
||||
|
||||
public function getCreatedAtAttribute($value)
|
||||
{
|
||||
return date('Y-m-d H:i:s', strtotime($value));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class WithdrawalModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_withdrawal';
|
||||
protected $fillable = [
|
||||
'id', 'user_id', 'amount', 'is_status', 'is_account',
|
||||
'created_at', 'updated_at', 'invoice_id'
|
||||
];
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasMany(AccountModel::class, 'id', 'user_id');
|
||||
}
|
||||
|
||||
public function rekening()
|
||||
{
|
||||
return $this->hasMany(RekeningModel::class, 'id', 'is_account');
|
||||
}
|
||||
|
||||
public function getCreatedAtAttribute($value)
|
||||
{
|
||||
return date('Y-m-d H:i:s', strtotime($value));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Events;
|
||||
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Modules\Seller\Entities\TicketResponseModel;
|
||||
|
||||
class TicketCreated
|
||||
{
|
||||
use Dispatchable, SerializesModels;
|
||||
public $ticketResponse;
|
||||
|
||||
public function __construct(TicketResponseModel $ticketResponse)
|
||||
{
|
||||
$this->ticketResponse = $ticketResponse;
|
||||
dd($ticketResponse);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,364 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Http\Controllers;
|
||||
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use DataTables;
|
||||
|
||||
use Modules\Seller\Entities\RekeningModel;
|
||||
use Modules\Seller\Entities\RekeningBankModel as ListBank;
|
||||
use Modules\User\Entities\OrderModel as Order;
|
||||
use Modules\Seller\Entities\WithdrawalModel as Withdrawal;
|
||||
use Modules\Seller\Entities\SitesModel as Sites;
|
||||
use Modules\Seller\Entities\DomainModel as Domain;
|
||||
use App\Models\LogActivites;
|
||||
|
||||
use App\Enums\GlobalEnum;
|
||||
use App\Helpers\MailerHelper as Mailers;
|
||||
|
||||
class AccountController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Akun Saya'
|
||||
];
|
||||
|
||||
$getTotalOrders = Order::where('sell_id', auth()->user()->id)->count();
|
||||
$getTotalWebsite = Sites::where('user_id', auth()->user()->id)->count();
|
||||
$getTotalDomain = Domain::where('user_id', user()->id)->count();
|
||||
|
||||
return view('seller::index', compact('data', 'getTotalOrders', 'getTotalWebsite', 'getTotalDomain'));
|
||||
}
|
||||
|
||||
// controller::for-rekening
|
||||
public function rekening(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = RekeningModel::where('user_id', auth()->user()->id)->select('*');
|
||||
// Convert the Eloquent Collection to a regular PHP array
|
||||
$data->each(function ($item, $key) {
|
||||
$item->rowIndex = $key + 1;
|
||||
});
|
||||
|
||||
return Datatables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('title-post', function($row){
|
||||
|
||||
$getNameofBank = ListBank::where('id', $row->rid)->first()->nama;
|
||||
$text = '
|
||||
<p class="mb-0">' . $row->account_number . '</p>
|
||||
<p class="mb-0 small">' . $getNameofBank . '</p>
|
||||
';
|
||||
return $text;
|
||||
})
|
||||
->addColumn('action', function($row){
|
||||
$edit = route('rekening.edit', ['id' => $row->id]);
|
||||
$delete = route('rekening.delete', ['id' => $row->id]);
|
||||
$btn = '
|
||||
<a href="' . $edit . '" class="btn btn-light btn-sm px-4"><i class="ki-outline ki-pencil"></i></a>
|
||||
<a data-url="' . $delete . '" href="#" class="btn btn-light btn-sm deleteContent px-4"><i class="ki-outline ki-trash"></i></a>
|
||||
';
|
||||
return $btn;
|
||||
})
|
||||
->addColumn('status', function($row){
|
||||
if ($row->is_active == GlobalEnum::isRekeningActive) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-success text-success">Aktif</span>';
|
||||
} elseif($row->is_active == GlobalEnum::isRekeningInactive) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-primary text-primary">Tidak Aktif</span>';
|
||||
}
|
||||
})
|
||||
->rawColumns(['title-post','action','status'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Semua Rekening',
|
||||
'button' => true,
|
||||
'module' => [
|
||||
'url' => route('rekening.create'),
|
||||
'name' => 'Tambah baru'
|
||||
]
|
||||
];
|
||||
|
||||
return view('seller::account.rekening.index', compact('data'));
|
||||
}
|
||||
|
||||
public function createRekening()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Tambah Baru'
|
||||
];
|
||||
$listAllBank = ListBank::all();
|
||||
|
||||
return view('seller::account.rekening.add', compact('data', 'listAllBank'));
|
||||
}
|
||||
|
||||
public function storeRekening(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'account_number' => 'required|numeric',
|
||||
'rid' => 'required',
|
||||
]);
|
||||
|
||||
if($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator->errors());
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
|
||||
$post = new RekeningModel([
|
||||
'id' => Str::uuid(),
|
||||
'user_id' => auth()->user()->id,
|
||||
'account_number' => $input['account_number'],
|
||||
'rid' => $input['rid'],
|
||||
'name' => $input['name'],
|
||||
'is_active' => 2
|
||||
]);
|
||||
|
||||
$check = RekeningModel::where('account_number', $input['account_number'])->count();
|
||||
if($check == 0) {
|
||||
if($post->save()) {
|
||||
return redirect()->route('rekening')->with('swal', swal_alert('success', 'Anda berhasil menambahkan rekening.'));
|
||||
} else {
|
||||
return redirect()->route('rekening')->with('swal', swal_alert('error', 'Terjadi kesalahan saat menambahkan rekening.'));
|
||||
}
|
||||
} else {
|
||||
return redirect()->route('rekening')->with('swal', swal_alert('error', 'Ditemukan data yang telah ada'));
|
||||
}
|
||||
}
|
||||
|
||||
public function editRekening($id)
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Edit'
|
||||
];
|
||||
|
||||
$listAllBank = ListBank::all();
|
||||
$getDetailAccount = RekeningModel::find($id);
|
||||
|
||||
return view('seller::account.rekening.edit', compact('data', 'listAllBank', 'getDetailAccount'));
|
||||
}
|
||||
|
||||
public function updateRekening(Request $request, $id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'rid' => 'required',
|
||||
'account_number' => 'required|numeric',
|
||||
'is_active' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$account = RekeningModel::find($id);
|
||||
|
||||
if($account) {
|
||||
$account->name = $input['name'];
|
||||
$account->rid = $input['rid'];
|
||||
$account->account_number = $input['account_number'];
|
||||
$account->is_active = $input['is_active'];
|
||||
$account->save();
|
||||
|
||||
return redirect()->route('rekening')->with('swal', swal_alert('success', 'Berhasil memperbarui rekening.'));
|
||||
} else {
|
||||
return redirect()->route('rekening')->with('swal', swal_alert('error', 'Rekening tidak ditemukan.'));
|
||||
}
|
||||
}
|
||||
|
||||
public function removeRekening($id)
|
||||
{
|
||||
$account = RekeningModel::find($id);
|
||||
if($account) {
|
||||
$account->delete();
|
||||
return redirect()->route('rekening')->with('swal', swal_alert('success', 'Berhasil menghapus data.'));
|
||||
} else {
|
||||
return redirect()->route('rekening')->with('swal', swal_alert('error', 'Site tidak ditemukan.'));
|
||||
}
|
||||
}
|
||||
|
||||
public function withdrawal(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = Withdrawal::where('user_id', auth()->user()->id)->select('id', 'invoice_id', 'user_id', 'amount', 'is_status', 'is_account');
|
||||
return Datatables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('invoice-number', function($row){
|
||||
$text = '
|
||||
<p class="fw-bold mb-n1">#' . $row->invoice_id . '</p>
|
||||
';
|
||||
return $text;
|
||||
})
|
||||
->addColumn('account', function($row){
|
||||
$checkBank = ListBank::where('id', $row->rekening->first()->rid)->first();
|
||||
$checkUserBank = RekeningModel::where('id', $row->is_account)->first();
|
||||
$text = '
|
||||
<p class="fw-bold mb-0">' . $checkUserBank->account_number . '</p>
|
||||
<p class="small text-gray-400 mb-n1">' . $checkUserBank->name . ' / ' . $checkBank->nama . '</p>
|
||||
';
|
||||
|
||||
return $text;
|
||||
|
||||
})
|
||||
->addColumn('status', function($row){
|
||||
if ($row->is_status == GlobalEnum::isWithdrawPending) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-warning text-warning py-3 px-4 fs-7">Menunggu Pembayaran</span>';
|
||||
} elseif($row->is_status == GlobalEnum::isWithdrawOnProgress) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-primary text-primary py-3 px-4 fs-7">Sedang Proses</span>';
|
||||
} elseif($row->is_status == GlobalEnum::isWithdrawPaid) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-success text-success py-3 px-4 fs-7">Dibayarkan</span>';
|
||||
} elseif($row->is_status == GlobalEnum::isWithdrawCancel) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-danger text-danger py-3 px-4 fs-7">Dibatalkan</span>';
|
||||
}
|
||||
})
|
||||
->addColumn('price', function($row){
|
||||
return 'Rp. ' . number_format($row->amount, 0, ',', '.');
|
||||
})
|
||||
->rawColumns(['invoice-number','account','status','price'])
|
||||
->filter(function ($query) use ($request) {
|
||||
if ($request->has('search')) {
|
||||
$search = $request->get('search')['value'];
|
||||
|
||||
$filterCategory = explode('|', $search);
|
||||
if($filterCategory[0] === 'status') {
|
||||
if(!empty($filterCategory[1])) {
|
||||
$query->where('is_status', '=', $filterCategory[1]);
|
||||
} else {
|
||||
$query->get();
|
||||
}
|
||||
} elseif($filterCategory[0] === 'invoice') {
|
||||
if(!empty($filterCategory[1])) {
|
||||
$query->where('invoice_id', 'LIKE', "%$filterCategory[1]%");
|
||||
} else {
|
||||
$query->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
->make(true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Penarikan',
|
||||
'button' => true,
|
||||
'module' => [
|
||||
'url' => route('withdrawal.create'),
|
||||
'name' => 'Tarik Tunai'
|
||||
]
|
||||
];
|
||||
|
||||
return view('seller::account.withdraw.index', compact('data'));
|
||||
}
|
||||
|
||||
public function createRequest()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Tarik Tunai',
|
||||
];
|
||||
|
||||
$getListOfBank = RekeningModel::where('user_id', user()->id)->get();
|
||||
return view('seller::account.withdraw.add', compact('data', 'getListOfBank'));
|
||||
}
|
||||
|
||||
public function storeRequest(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'amount' => 'required|numeric',
|
||||
'is_account' => 'required'
|
||||
]);
|
||||
|
||||
if($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$invoice_number = invoiceGenerator();
|
||||
|
||||
$post = new Withdrawal([
|
||||
'id' => Str::uuid(),
|
||||
'invoice_id' => $invoice_number,
|
||||
'user_id' => user()->id,
|
||||
'amount' => $input['amount'],
|
||||
'is_status' => GlobalEnum::isWithdrawPending,
|
||||
'is_account' => $input['is_account']
|
||||
]);
|
||||
|
||||
if(user()->income < $input['amount']) {
|
||||
return redirect()->route('withdrawal')->with('swal', swal_alert('error', 'Saldo tidak mencukupi untuk melakukan penarikan.'));
|
||||
}
|
||||
|
||||
if($post->save())
|
||||
{
|
||||
$sendEmailToUser = Mailers::to(user()->email, false, 'email.transaction.place-withdrawal', [
|
||||
'message' => 'Anda berhasil melakukan permintaan penarikan tunai pada tanggal ' . date('j F Y H:i:s'),
|
||||
'subject' => 'Informasi Penarikan Tunai',
|
||||
'amount' => $input['amount'],
|
||||
'name' => user()->name,
|
||||
'status' => 'Menunggu proses dari pihak administasi',
|
||||
]);
|
||||
if($sendEmailToUser) {
|
||||
LogActivites::default([
|
||||
'causedBy' => user()->id,
|
||||
'logType' => GlobalEnum::LogOfGeneral,
|
||||
'withContent' => [
|
||||
'status' => 'minus',
|
||||
'text' => 'Anda berhasil melakukan permintaan tarik tunai pada tanggal ' . date('Y-m-d H:i:s'),
|
||||
]
|
||||
]);
|
||||
return redirect()->route('withdrawal')->with('swal', swal_alert('success', 'Anda berhasil melakukan permintaan tarik tunai.'));
|
||||
} else {
|
||||
return redirect()->route('withdrawal')->with('swal', swal_alert('error', 'Terjadi kesalahan saat melakukan permintaan penarikan.'));
|
||||
}
|
||||
} else {
|
||||
return redirect()->route('withdrawal')->with('swal', swal_alert('error', 'Terjadi kesalahan/data telah ada pada sistem.'));
|
||||
}
|
||||
}
|
||||
|
||||
public function viewRequest($invoice)
|
||||
{
|
||||
$payment = Withdrawal::find($invoice);
|
||||
if($payment) {
|
||||
$data = [
|
||||
'subtitle' => 'Detil Penarikan',
|
||||
];
|
||||
|
||||
return view('seller::account.withdraw.detail', compact('data', 'payment'));
|
||||
} else {
|
||||
return redirect()->route('withdrawal')->with('swal', swal_alert('error', 'Data tidak ditemukan.'));
|
||||
}
|
||||
}
|
||||
|
||||
public function cancelRequest($invoice)
|
||||
{
|
||||
$payment = Withdrawal::find($invoice);
|
||||
if($payment) {
|
||||
|
||||
$payment->is_status = GlobalEnum::isWithdrawCancel;
|
||||
if($payment->save()) {
|
||||
LogActivites::default([
|
||||
'causedBy' => user()->id,
|
||||
'logType' => GlobalEnum::LogOfGeneral,
|
||||
'withContent' => [
|
||||
'status' => 'minus',
|
||||
'text' => 'Anda berhasil melakukan pembatalan tarik tunai dengan kode invoice ' . $payment->invoice_id .' pada tanggal ' . date('Y-m-d H:i:s'),
|
||||
]
|
||||
]);
|
||||
return redirect()->route('withdrawal')->with('swal', swal_alert('success', 'Anda berhasil melakukan pembatalan tarik tunai.'));
|
||||
} else {
|
||||
return redirect()->route('withdrawal')->with('swal', swal_alert('error', 'Terjadi kesalahan saat melakukan pembatalan penarikan.'));
|
||||
}
|
||||
} else {
|
||||
return redirect()->route('withdrawal')->with('swal', swal_alert('error', 'Data tidak ditemukan.'));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Http\Controllers;
|
||||
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class DepositsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('seller::index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('seller::create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param Request $request
|
||||
* @return Renderable
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('seller::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('seller::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,241 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use DataTables;
|
||||
|
||||
// additional library loaded
|
||||
use App\Enums\GlobalEnum;
|
||||
use App\Helpers\MailerHelper as Mailers;
|
||||
|
||||
// additional model binding
|
||||
use Modules\User\Entities\OrderModel as Order;
|
||||
use Modules\User\Entities\OrderHistoryModel as OrderHistory;
|
||||
use Modules\Seller\Entities\BillingModel as Billing;
|
||||
use Modules\Seller\Entities\AccountModel as Account;
|
||||
use Modules\Seller\Entities\PaymentModel as Payment;
|
||||
use App\Models\LogActivites;
|
||||
|
||||
class OrdersController extends Controller
|
||||
{
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = Order::where('sell_id', auth()->user()->id)->select('*')->orderBy('created_at', 'desc');
|
||||
return Datatables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('ticket-invoice', function($row){
|
||||
$text = '
|
||||
<p class="fw-bold">#' . $row->invoice_number . '</p>
|
||||
';
|
||||
return $text;
|
||||
})
|
||||
->addColumn('title-post', function($row){
|
||||
$text = '
|
||||
<p class="mb-0 fw-bold">' . removeUrlPrefix($row->website_url) . '</p>
|
||||
<p class="mb-0 small text-muted">Terakhir diperbarui pada ' . date_formatting($row->updated_at, 'timeago') . '</p>
|
||||
';
|
||||
return $text;
|
||||
})
|
||||
->addColumn('author', function($row){
|
||||
return '
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="ms-3" data-bs-toggle="tooltip" data-bs-placement="top" title="' . $row->user->first()->name . '"><span>' . $row->user->first()->name . '</span></div>
|
||||
</div>
|
||||
';
|
||||
})
|
||||
->addColumn('status', function($row){
|
||||
if ($row->is_status == GlobalEnum::isOrderRequested) {
|
||||
return '<span class="mb-1 badge font-medium bg-dark text-white py-3 px-4 fs-7 w-100 text-center">Menunggu</span>';
|
||||
} elseif($row->is_status == GlobalEnum::isOrderOnWorking) {
|
||||
return '<span class="mb-1 badge font-medium bg-primary text-white py-3 px-4 fs-7 w-100 text-center">Dalam pengerjaan</span>';
|
||||
} elseif($row->is_status == GlobalEnum::isOrderSubmitted) {
|
||||
return '<span class="mb-1 badge font-medium bg-danger text-white py-3 px-4 fs-7 w-100 text-center">Dikirim</span>';
|
||||
} elseif($row->is_status == GlobalEnum::isOrderCompleted) {
|
||||
return '<span class="mb-1 badge font-medium bg-success text-white py-3 px-4 fs-7 w-100 text-center">Selesai</span>';
|
||||
} elseif($row->is_status == GlobalEnum::isOrderReqCancel) {
|
||||
return '<span class="mb-1 badge font-medium bg-danger text-white py-3 px-4 fs-7 w-100 text-center">Permintaan Ditolak</span>';
|
||||
} elseif($row->is_status == GlobalEnum::isOrderCancelled) {
|
||||
return '<span class="mb-1 badge font-medium bg-danger text-white py-3 px-4 fs-7 w-100 text-center">Dibatalkan</span>';
|
||||
} elseif($row->is_status == GlobalEnum::isOrderRejected) {
|
||||
return '<span class="mb-1 badge font-medium bg-danger text-white py-3 px-4 fs-7 w-100 text-center">Ditolak</span>';
|
||||
}
|
||||
})
|
||||
->addColumn('price', function($row){
|
||||
return 'Rp. ' . number_format($row->total, 0, ',', '.');
|
||||
})
|
||||
->filter(function ($query) use ($request) {
|
||||
if ($request->has('search')) {
|
||||
$search = $request->get('search')['value'];
|
||||
|
||||
$filterCategory = explode('|', $search);
|
||||
if($filterCategory[0] === 'status') {
|
||||
if(!empty($filterCategory[1])) {
|
||||
$query->where('is_status', '=', $filterCategory[1]);
|
||||
} else {
|
||||
$query->get();
|
||||
}
|
||||
} elseif($filterCategory[0] === 'orders') {
|
||||
if(!empty($filterCategory[1])) {
|
||||
$query->where('invoice_number', 'LIKE', "%$filterCategory[1]%");
|
||||
} else {
|
||||
$query->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
->rawColumns(['author','ticket-invoice','title-post','status','price'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Semua Pesanan'
|
||||
];
|
||||
|
||||
return view('seller::orders.index', compact('data'));
|
||||
}
|
||||
|
||||
public function view($invoice)
|
||||
{
|
||||
$check = Order::where('id', $invoice)->where('sell_id', user()->id)->first();
|
||||
if($check)
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Detil Pesanan'
|
||||
];
|
||||
|
||||
$getInfoOrders = $check;
|
||||
return view('seller::orders.detail', compact('data', 'getInfoOrders'));
|
||||
} else {
|
||||
return redirect()->back()->with('swal', swal_alert('error', 'Tidak ditemukan data yang anda cari'));
|
||||
}
|
||||
}
|
||||
|
||||
public function cancelOrder(Request $request, $invoice)
|
||||
{
|
||||
$check = Order::where('id', $invoice)->where('sell_id', user()->id)->first();
|
||||
if($check)
|
||||
{
|
||||
$check->is_status = GlobalEnum::isOrderCancelled;
|
||||
$check->cancel_reason = $request->cancel_reason;
|
||||
$check->save();
|
||||
|
||||
OrderHistory::create([
|
||||
'id' => Str::uuid(),
|
||||
'order_id' => $check->id,
|
||||
'asActor' => 2,
|
||||
'is_status' => 5,
|
||||
'comment' => $request->cancel_reason
|
||||
]);
|
||||
|
||||
return redirect()->back()->with('swal', swal_alert('success', 'Pesanan anda telah dibatalkan'));
|
||||
} else {
|
||||
return redirect()->back()->with('swal', swal_alert('error', 'Tidak ditemukan data yang anda cari'));
|
||||
}
|
||||
}
|
||||
|
||||
public function accept(Request $request, $invoice)
|
||||
{
|
||||
$check = Order::where('id', $invoice)->where('sell_id', user()->id)->first();
|
||||
if($check)
|
||||
{
|
||||
$check->is_status = GlobalEnum::isOrderOnWorking;
|
||||
$check->save();
|
||||
|
||||
OrderHistory::create([
|
||||
'id' => Str::uuid(),
|
||||
'order_id' => $check->id,
|
||||
'asActor' => 2,
|
||||
'is_status' => 0,
|
||||
'comment' => 'Reseller menerima pesanan ini'
|
||||
]);
|
||||
|
||||
return redirect()->back()->with('swal', swal_alert('success', 'Pesanan telah anda terima, Mohon segera kerjakan dalam kurung waktu produk yang telah anda tentukan!'));
|
||||
} else {
|
||||
return redirect()->back()->with('swal', swal_alert('error', 'Tidak ditemukan data yang anda cari'));
|
||||
}
|
||||
}
|
||||
|
||||
public function process(Request $request, $invoice)
|
||||
{
|
||||
$check = Order::where('id', $invoice)->first();
|
||||
if($check)
|
||||
{
|
||||
$check->is_status = GlobalEnum::isOrderSubmitted;
|
||||
$check->save();
|
||||
|
||||
OrderHistory::create([
|
||||
'id' => Str::uuid(),
|
||||
'order_id' => $check->id,
|
||||
'url' => $request->url,
|
||||
'asActor' => 2,
|
||||
'is_status' => GlobalEnum::isHistoryDone,
|
||||
'comment' => 'Reseller mengirimkan laporan tugas'
|
||||
]);
|
||||
|
||||
return redirect()->back()->with('swal', swal_alert('success', 'Anda telah berhasil mengirimkan laporan tugas, silahkan tunggu 1x24 jam agar pemesan dapat melakukan review pesanan.'));
|
||||
} else {
|
||||
return redirect()->back()->with('swal', swal_alert('error', 'Tidak ditemukan data yang anda cari'));
|
||||
}
|
||||
}
|
||||
|
||||
public function revision(Request $request, $invoice)
|
||||
{
|
||||
$check = Order::where('id', $invoice)->where('sell_id', user()->id)->first();
|
||||
if($check)
|
||||
{
|
||||
$check->is_status = GlobalEnum::isOrderSubmitted;
|
||||
$check->save();
|
||||
|
||||
OrderHistory::create([
|
||||
'id' => Str::uuid(),
|
||||
'order_id' => $check->id,
|
||||
'url' => $request->url,
|
||||
'asActor' => 2,
|
||||
'is_status' => GlobalEnum::isHistoryDone,
|
||||
'comment' => 'Reseller mengirimkan laporan tugas revisi'
|
||||
]);
|
||||
|
||||
return redirect()->back()->with('swal', swal_alert('success', 'Anda telah berhasil mengirimkan laporan tugas revisi, silahkan tunggu 1x24 jam agar pemesan dapat melakukan review pesanan.'));
|
||||
} else {
|
||||
return redirect()->back()->with('swal', swal_alert('error', 'Tidak ditemukan data yang anda cari'));
|
||||
}
|
||||
}
|
||||
|
||||
public function feedback(Request $request, $invoice)
|
||||
{
|
||||
$check = Order::where('id', $invoice)->where('sell_id', user()->id)->first();
|
||||
if($check)
|
||||
{
|
||||
$check->last_seller_message = clean($request->feedback);
|
||||
$check->save();
|
||||
|
||||
$save = auth()->user()->update([
|
||||
'income' => auth()->user()->income + $check->price
|
||||
]);
|
||||
|
||||
if($save) {
|
||||
LogActivites::default([
|
||||
'causedBy' => user()->id,
|
||||
'withContent' => [
|
||||
'status' => 'add',
|
||||
'text' => 'Anda telah menerima saldo sebesar ' . $check->price,
|
||||
]
|
||||
]);
|
||||
|
||||
return redirect()->back()->with('swal', swal_alert('success', 'Anda telah berhasil mengirimkan ulasan untuk buyer dan tugas telah dinyatakan selesai.'));
|
||||
} else {
|
||||
return redirect()->back()->with('swal', swal_alert('error', 'Tidak ditemukan data yang anda cari'));
|
||||
}
|
||||
} else {
|
||||
return redirect()->back()->with('swal', swal_alert('error', 'Tidak ditemukan data yang anda cari'));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Http\Controllers;
|
||||
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use DataTables;
|
||||
|
||||
use Modules\Seller\Entities\RekeningModel;
|
||||
use Modules\Seller\Entities\RekeningBankModel as ListBank;
|
||||
use Modules\User\Entities\OrderModel as Order;
|
||||
use Modules\Seller\Entities\WithdrawalModel as Withdrawal;
|
||||
use App\Models\LogActivites;
|
||||
use WithPagination;
|
||||
|
||||
use App\Enums\GlobalEnum;
|
||||
|
||||
class ReportController extends Controller
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
$getTotalIncomeOrder = Order::where('sell_id', user()->id)->sum('total');
|
||||
$getTotalPendingIncomeOrder = Order::where('sell_id', user()->id)->where('is_status', GlobalEnum::isOrderOnWorking)->sum('total');
|
||||
$getListOrder = Order::where('sell_id', user()->id)->orderBy('created_at', 'desc')->limit(5)->get();
|
||||
$getFlowOrder = Order::getTotalIncomeSeller();
|
||||
$getTotalOrder = Order::where('sell_id', user()->id)->count();
|
||||
$getListAwaitingWithdrawal = Withdrawal::where('is_status', 1)->where('user_id', user()->id)->count();
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Keuangan dan Transaksi'
|
||||
];
|
||||
return view('seller::reports.index', compact('data', 'getTotalIncomeOrder', 'getTotalPendingIncomeOrder', 'getListOrder', 'getFlowOrder', 'getListAwaitingWithdrawal', 'getTotalOrder'));
|
||||
}
|
||||
|
||||
public function statistic(Request $request)
|
||||
{
|
||||
$logsActivity = LogActivites::where('logType', GlobalEnum::LogOfLogin)->where('causedBy', user()->id)->orderBy('created_at', 'desc')->limit(5)->get();
|
||||
$logGeneral = LogActivites::where('logType', GlobalEnum::LogOfGeneral)->where('causedBy', user()->id)->orderBy('created_at', 'desc')->limit(5)->get();
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Riwayat Aktifitas'
|
||||
];
|
||||
return view('seller::reports.statistic', compact('data', 'logsActivity', 'logGeneral'));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Http\Controllers;
|
||||
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use DataTables;
|
||||
|
||||
use Modules\Seller\Entities\RekeningModel;
|
||||
use Modules\Seller\Entities\RekeningBankModel as ListBank;
|
||||
use Modules\User\Entities\OrderModel as Order;
|
||||
use Modules\Seller\Entities\DomainModel as Domain;
|
||||
use Modules\Seller\Entities\SitesModel as Sites;
|
||||
|
||||
use App\Enums\GlobalEnum;
|
||||
|
||||
class SellerController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Halaman Utama',
|
||||
];
|
||||
|
||||
$getTotalOrders = Order::where('sell_id', auth()->user()->id)->where('is_status', GlobalEnum::isOrderRequested)->count();
|
||||
$getTotalOrdersCancel = Order::where('sell_id', auth()->user()->id)->where('is_status', GlobalEnum::isOrderCancelled)->count();
|
||||
$getTotalWebsite = Sites::where('user_id', auth()->user()->id)->count();
|
||||
$getTotalDomain = Domain::where('user_id', auth()->user()->id)->count();
|
||||
$getListOrder = Order::where('sell_id', auth()->user()->id)->orderBy('created_at', 'desc')->limit(10)->get();
|
||||
|
||||
return view('seller::index', compact('data', 'getTotalOrders', 'getTotalWebsite', 'getTotalDomain', 'getListOrder', 'getTotalOrdersCancel'));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,473 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Http\Controllers;
|
||||
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use DataTables;
|
||||
|
||||
use Modules\Seller\Entities\SitesModel;
|
||||
use Modules\Seller\Entities\SitesCategoryModel as NicheWebsite;
|
||||
use Modules\Seller\Entities\DomainModel;
|
||||
|
||||
use App\Enums\GlobalEnum;
|
||||
|
||||
class SitesController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
// 94
|
||||
if ($request->ajax()) {
|
||||
$data = SitesModel::where('user_id', auth()->user()->id)->select('url','is_language','created_at','is_url_category','id','is_status','is_post_price','is_delivery_time','is_word_limit');
|
||||
return Datatables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('title-post', function($row){
|
||||
$text = '
|
||||
<p class="mb-0">' . $row->url . '</p>
|
||||
<div class="d-flex">
|
||||
<span class="text-muted small me-2">Bahasa: ' . ucfirst($row->is_language) . ' -</span>
|
||||
<span class="text-muted small"> ' . date('j F Y', strtotime($row->created_at)) . '</span>
|
||||
</div>
|
||||
<p class="mb-0 small">' . $row->is_url_category . '</p>
|
||||
';
|
||||
return $text;
|
||||
})
|
||||
->addColumn('language', function($row){
|
||||
if (preg_match('/^indonesia/i', $row->is_language)) {
|
||||
return '
|
||||
<span class="fs-8 rounded bg-light py-3 px-2">
|
||||
<img class="w-15px h-15px rounded-1 mx-1" src="' . frontend('media/flags/indonesia.svg') . '" alt="">
|
||||
Indonesia
|
||||
</span>
|
||||
';
|
||||
} else {
|
||||
return '
|
||||
<span class="fs-8 rounded bg-light py-3 px-2">
|
||||
<img class="w-15px h-15px rounded-1 mx-1" src="' . frontend('media/flags/united-states.svg') . '" alt="">
|
||||
English
|
||||
</span>
|
||||
';
|
||||
}
|
||||
})
|
||||
->addColumn('is_status', function($row){
|
||||
if ($row->is_status == GlobalEnum::isSiteActive) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-success text-success">Aktif</span>';
|
||||
} elseif($row->is_status == GlobalEnum::isSiteInReview) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-primary text-primary">Dalam review</span>';
|
||||
} elseif($row->is_status == GlobalEnum::isSiteNotActive) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-danger text-danger">Tidak aktif</span>';
|
||||
} elseif($row->is_status == GlobalEnum::isSiteRejected) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-warning text-warning">Ditolak</span>';
|
||||
} elseif($row->is_status == GlobalEnum::isSiteDeactivated) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-info text-info">Dimatikan</span>';
|
||||
}
|
||||
})
|
||||
->addColumn('post_price', function($row){
|
||||
return 'Rp. ' . number_format($row->is_post_price, 0, ',', '.');
|
||||
})
|
||||
->addColumn('delivery_time', function($row){
|
||||
return $row->is_delivery_time . ' Hari';
|
||||
})
|
||||
->addColumn('word_limit', function($row){
|
||||
return $row->is_word_limit . ' Kata';
|
||||
})
|
||||
->rawColumns(['title-post','language','is_status','post_price','delivery_time','word_limit'])
|
||||
->filter(function ($query) use ($request) {
|
||||
if ($request->has('search')) {
|
||||
$search = $request->get('search')['value'];
|
||||
|
||||
$filterCategory = explode('|', $search);
|
||||
if($filterCategory[0] === 'status') {
|
||||
if(!empty($filterCategory[1])) {
|
||||
$query->where('is_status', '=', $filterCategory[1]);
|
||||
} else {
|
||||
$query->get();
|
||||
}
|
||||
} elseif($filterCategory[0] === 'sites') {
|
||||
if(!empty($filterCategory[1])) {
|
||||
$query->where('url', 'LIKE', "%$filterCategory[1]%");
|
||||
} else {
|
||||
$query->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
->make(true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Semua Sites',
|
||||
'button' => true,
|
||||
'module' => [
|
||||
'url' => route('sites.create'),
|
||||
'name' => 'Tambah baru'
|
||||
]
|
||||
];
|
||||
|
||||
return view('seller::sites.index', compact('data'));
|
||||
}
|
||||
public function create()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Tambah Baru'
|
||||
];
|
||||
|
||||
$getNicheCategory = NicheWebsite::where('is_status', 1)->get();
|
||||
|
||||
return view('seller::sites.add', compact('data', 'getNicheCategory'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'url' => 'required',
|
||||
'description' => 'required',
|
||||
'is_role' => 'required',
|
||||
'is_type' => 'required',
|
||||
'is_language' => 'required',
|
||||
'is_post_price' => 'required',
|
||||
'is_delivery_time' => 'required',
|
||||
'is_word_limit' => 'required',
|
||||
'is_post_sample' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
|
||||
$post = new SitesModel([
|
||||
'id' => Str::uuid(),
|
||||
'user_id' => user()['id'],
|
||||
'url' => $input['url'], // Membersihkan input judul menggunakan Purifier
|
||||
'description' => clean($input['description']), // Membersihkan input deskripsi menggunakan Purifier
|
||||
'is_role' => $input['is_role'],
|
||||
'is_type' => $input['is_type'],
|
||||
'is_language' => $input['is_language'],
|
||||
'is_post_price' => $input['is_post_price'],
|
||||
'is_delivery_time' => $input['is_delivery_time'],
|
||||
'is_content_included' => !empty($input['is_content_included']) ? $input['is_content_included'] : 0,
|
||||
'is_content_price' => !empty($input['is_content_price']) ? $input['is_content_price'] : null,
|
||||
'is_word_limit' => $input['is_word_limit'],
|
||||
'is_post_sample' => $input['is_post_sample'],
|
||||
'is_url_category' => implode(',' ,$input['is_url_category']), // Membersihkan input kategori menggunakan Purifier
|
||||
'is_status' => 2,
|
||||
]);
|
||||
|
||||
$check = SitesModel::where('url', $input['url'])->count();
|
||||
if ($check == 0) {
|
||||
if ($post->save()) {
|
||||
return redirect()->route('sites')->with('swal', swal_alert('success', 'Anda berhasil menambahkan data baru, Data akan segera diproses oleh administrator'));
|
||||
} else {
|
||||
return redirect()->route('sites')->with('swal', swal_alert('error', 'Terjadi kesalahan pada sistem!'));
|
||||
}
|
||||
} else {
|
||||
return redirect()->route('sites')->with('swal', swal_alert('error', 'Galat! Ditemukan data yang sudah ada.'));
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Edit',
|
||||
];
|
||||
|
||||
$getSitesInfo = SitesModel::find($id);
|
||||
$getNicheCategory = NicheWebsite::where('is_status', 1)->get();
|
||||
|
||||
return view('seller::sites.edit', compact('data', 'getNicheCategory', 'getSitesInfo'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'url' => 'required',
|
||||
'description' => 'required',
|
||||
'is_role' => 'required',
|
||||
'is_type' => 'required',
|
||||
'is_language' => 'required',
|
||||
'is_post_price' => 'required',
|
||||
'is_delivery_time' => 'required',
|
||||
'is_word_limit' => 'required',
|
||||
'is_post_sample' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$sites = SitesModel::find($id);
|
||||
|
||||
if($sites) {
|
||||
$sites->url = $input['url'];
|
||||
$sites->description = clean($input['description']);
|
||||
$sites->is_role = $input['is_role'];
|
||||
$sites->is_type = $input['is_type'];
|
||||
$sites->is_language = $input['is_language'];
|
||||
$sites->is_post_price = $input['is_post_price'];
|
||||
$sites->is_delivery_time = $input['is_delivery_time'];
|
||||
$sites->is_content_included = !empty($input['is_content_included']) ? $input['is_content_included'] : 0;
|
||||
$sites->is_content_price = !empty($input['is_content_price']) ? $input['is_content_price'] : null;
|
||||
$sites->is_word_limit = $input['is_word_limit'];
|
||||
$sites->is_post_sample = $input['is_post_sample'];
|
||||
$sites->is_url_category = implode(',' ,$input['is_url_category']);
|
||||
$sites->is_status = 2;
|
||||
$sites->save();
|
||||
|
||||
return redirect()->route('sites')->with('swal', swal_alert('success', 'Berhasil memperbarui site.'));
|
||||
} else {
|
||||
return redirect()->route('sites')->with('swal', swal_alert('error', 'Site tidak ditemukan.'));
|
||||
}
|
||||
}
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
$check = SitesModel::where('id', $id)->first();
|
||||
|
||||
if($check) {
|
||||
$detail = [
|
||||
'url' => removeUrlPrefix($check->url),
|
||||
'secure' => isUrlSecure($check->url),
|
||||
'description' => $check->description,
|
||||
'is_role' => $check->is_role == GlobalEnum::isSiteOwner ? 'Owner' : 'Member',
|
||||
'is_type' => $check->is_type == GlobalEnum::isSiteTypeDoFollow ? 'Do-Follow' : 'No-Follow',
|
||||
'is_language' => ucfirst($check->is_language),
|
||||
'is_post_price' => rupiah_changer($check->is_post_price),
|
||||
'is_delivery_time' => $check->is_delivery_time,
|
||||
'is_word_limit' => $check->is_word_limit,
|
||||
'is_post_sample' => $check->is_post_sample,
|
||||
'is_content_included' => $check->is_content_included == 1 ? 'Ya' : 'Tidak',
|
||||
'is_content_price' => rupiah_changer($check->is_content_price),
|
||||
'is_url_category' => empty($check->is_url_category) ? '-' : $check->is_url_category,
|
||||
'is_page_authority' => $check->is_page_authority,
|
||||
'is_domain_authority' => $check->is_domain_authority,
|
||||
'is_seller' => user()->name,
|
||||
];
|
||||
|
||||
return $detail;
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$sites = SitesModel::find($id);
|
||||
if($sites) {
|
||||
$sites->delete();
|
||||
return redirect()->route('sites')->with('swal', swal_alert('success', 'Berhasil menghapus data.'));
|
||||
} else {
|
||||
return redirect()->route('sites')->with('swal', swal_alert('error', 'Site tidak ditemukan.'));
|
||||
}
|
||||
}
|
||||
|
||||
// domain
|
||||
public function domain(Request $request)
|
||||
{
|
||||
|
||||
if ($request->ajax()) {
|
||||
$data = DomainModel::where('user_id', auth()->user()->id)->select('url','user_id','is_url_from_website','created_at','is_price','id','is_status','is_delivery_time');
|
||||
return Datatables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('title-post', function($row){
|
||||
if($row->is_url_from_website != null) {
|
||||
$text = '
|
||||
<p class="mb-0">' . removeUrlPrefix($row->is_url_from_website) . '</p>
|
||||
';
|
||||
} else {
|
||||
$text = '
|
||||
<p class="mb-0">' . removeUrlPrefix($row->url) . '</p>
|
||||
';
|
||||
}
|
||||
return $text;
|
||||
})
|
||||
->addColumn('is_status', function($row){
|
||||
if ($row->is_status == 1) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-success text-success py-3 px-4 fs-7">Aktif</span>';
|
||||
} elseif($row->is_status == 2) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-primary text-primary py-3 px-4 fs-7">Menunggu</span>';
|
||||
} elseif($row->is_status == 3) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-info text-info py-3 px-4 fs-7">Dalam Review</span>';
|
||||
} elseif($row->is_status == 4) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-danger text-danger py-3 px-4 fs-7">Ditolak</span>';
|
||||
}
|
||||
})
|
||||
->addColumn('post_price', function($row){
|
||||
return 'Rp. ' . number_format($row->is_price, 0, ',', '.');
|
||||
})
|
||||
->addColumn('delivery_time', function($row){
|
||||
return $row->is_delivery_time . ' Hari';
|
||||
})
|
||||
->rawColumns(['title-post','author','is_status','post_price','delivery_time'])
|
||||
->filter(function ($query) use ($request) {
|
||||
if ($request->has('search')) {
|
||||
$search = $request->get('search')['value'];
|
||||
|
||||
$filterCategory = explode('|', $search);
|
||||
if($filterCategory[0] === 'status') {
|
||||
if(!empty($filterCategory[1])) {
|
||||
$query->where('is_status', '=', $filterCategory[1]);
|
||||
} else {
|
||||
$query->get();
|
||||
}
|
||||
} elseif($filterCategory[0] === 'sites') {
|
||||
if(!empty($filterCategory[1])) {
|
||||
if($query->where('url', 'LIKE', "%$filterCategory[1]%")->count() == 0) {
|
||||
$query->where('is_url_from_website', 'LIKE', "%$filterCategory[1]%");
|
||||
} else {
|
||||
$query->where('url', 'LIKE', "%$filterCategory[1]%");
|
||||
}
|
||||
} else {
|
||||
$query->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
->make(true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Semua Domain',
|
||||
'button' => true,
|
||||
'module' => [
|
||||
'url' => route('sites.domain.create'),
|
||||
'name' => 'Tambah baru'
|
||||
]
|
||||
];
|
||||
|
||||
return view('seller::sites.domain.index', compact('data'));
|
||||
}
|
||||
public function createDomain()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Tambah Baru'
|
||||
];
|
||||
|
||||
$getSiteLists = SitesModel::where('user_id', user()->id)->select('*')->get();
|
||||
return view('seller::sites.domain.add', compact('data', 'getSiteLists'));
|
||||
}
|
||||
|
||||
public function storeDomain(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'is_price' => 'required',
|
||||
'is_delivery_time' => 'required',
|
||||
'is_domain_authority' => 'required',
|
||||
'is_page_authority' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
|
||||
$post = new DomainModel([
|
||||
'id' => Str::uuid(),
|
||||
'user_id' => user()['id'],
|
||||
'url' => empty($input['url']) ? null : $input['url'], // Membersihkan input judul menggunakan Purifier
|
||||
'is_url_from_website' => empty($input['is_url_from_website']) ? null : $input['is_url_from_website'],
|
||||
'is_price' => $input['is_price'],
|
||||
'is_delivery_time' => $input['is_delivery_time'],
|
||||
'is_page_authority' => $input['is_page_authority'],
|
||||
'is_domain_authority' => $input['is_domain_authority'],
|
||||
'is_status' => 3
|
||||
]);
|
||||
|
||||
$check = DomainModel::where('user_id', auth()->user()->id)->where('url', $input['url'])->count();
|
||||
if ($check == 0) {
|
||||
if ($post->save()) {
|
||||
return redirect()->route('sites.domain')->with('swal', swal_alert('success', 'Anda berhasil menambahkan data baru, Data akan segera diproses oleh administrator'));
|
||||
} else {
|
||||
return redirect()->route('sites.domain')->with('swal', swal_alert('error', 'Terjadi kesalahan pada sistem!'));
|
||||
}
|
||||
} else {
|
||||
return redirect()->route('sites.domain')->with('swal', swal_alert('error', 'Galat! Ditemukan data yang sudah ada.'));
|
||||
}
|
||||
}
|
||||
|
||||
public function editDomain($id)
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Edit',
|
||||
];
|
||||
|
||||
$getSitesInfo = DomainModel::find($id);
|
||||
$getSiteLists = SitesModel::where('is_status', GlobalEnum::isSiteActive)
|
||||
->where('user_id', user()['id'])->get();
|
||||
|
||||
return view('admin.app.sites.domain.edit', compact('data', 'getSitesInfo', 'getSiteLists'));
|
||||
}
|
||||
|
||||
public function updateDomain(Request $request, $id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'is_price' => 'required',
|
||||
'is_delivery_time' => 'required',
|
||||
'is_domain_authority' => 'required',
|
||||
'is_page_authority' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$sites = DomainModel::find($id);
|
||||
|
||||
if($sites) {
|
||||
$sites->url = $input['url'];
|
||||
$sites->is_url_from_website = !empty($input['is_url_from_website']) ? $input['is_url_from_website'] : null;
|
||||
$sites->is_price = $input['is_price'];
|
||||
$sites->is_delivery_time = $input['is_delivery_time'];
|
||||
$sites->is_domain_authority = !empty($input['is_domain_authority']) ? $input['is_domain_authority'] : 0;
|
||||
$sites->is_page_authority = !empty($input['is_page_authority']) ? $input['is_page_authority'] : 0;
|
||||
$sites->is_status = $input['is_status'];
|
||||
$sites->save();
|
||||
|
||||
return redirect()->route('sites.domain')->with('swal', swal_alert('success', 'Berhasil memperbarui site.'));
|
||||
} else {
|
||||
return redirect()->route('sites.domain')->with('swal', swal_alert('error', 'Site tidak ditemukan.'));
|
||||
}
|
||||
}
|
||||
|
||||
public function destroyDomain($id)
|
||||
{
|
||||
$sites = DomainModel::find($id);
|
||||
if($sites) {
|
||||
$sites->delete();
|
||||
return redirect()->route('sites.domain')->with('swal', swal_alert('success', 'Berhasil menghapus data.'));
|
||||
} else {
|
||||
return redirect()->route('sites.domain')->with('swal', swal_alert('error', 'Site tidak ditemukan.'));
|
||||
}
|
||||
}
|
||||
|
||||
public function detailDomain($id)
|
||||
{
|
||||
$check = DomainModel::where('id', $id)->first();
|
||||
|
||||
if($check) {
|
||||
$detail = [
|
||||
'url' => empty($check->url) ? '-' : removeUrlPrefix($check->url),
|
||||
'url_website' => empty($check->is_url_from_website) ? '-' : $check->is_url_from_website,
|
||||
'is_price' => rupiah_changer($check->is_price),
|
||||
'secure' => isUrlSecure($check->url),
|
||||
'is_delivery_time' => $check->is_delivery_time,
|
||||
'is_page_authority' => $check->is_page_authority,
|
||||
'is_domain_authority' => $check->is_domain_authority,
|
||||
'is_seller' => user()->name,
|
||||
];
|
||||
|
||||
return $detail;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,158 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Http\Controllers;
|
||||
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use DataTables;
|
||||
use Modules\Seller\Entities\TicketModel;
|
||||
use Modules\Seller\Entities\TicketResponseModel;
|
||||
use Modules\Seller\Events\TicketCreated;
|
||||
use App\Enums\GlobalEnum;
|
||||
|
||||
class TicketController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = TicketModel::where('user_id', auth()->user()->id)->select('*');
|
||||
// Convert the Eloquent Collection to a regular PHP array
|
||||
$data->each(function ($item, $key) {
|
||||
$item->rowIndex = $key + 1;
|
||||
});
|
||||
|
||||
return Datatables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('title-post', function($row){
|
||||
$text = '
|
||||
<p class="mb-0">' . $row->subject . '</p>
|
||||
<p class="mb-0 small">Terakhir diperbarui pada ' . $row->updated_at->format('j F Y, h:i:s') . '</p>
|
||||
';
|
||||
return $text;
|
||||
})
|
||||
->addColumn('action', function($row){
|
||||
$view = route('ticket.view', ['id' => $row->id]);
|
||||
$delete = route('ticket.delete', ['id' => $row->id]);
|
||||
$btn = '
|
||||
<a href="' . $view . '" class="btn btn-light btn-sm px-4"><i class="ki-outline ki-eye"></i></a>
|
||||
<a data-url="' . $delete . '" href="#" class="btn btn-light btn-sm deleteContent px-4"><i class="ki-outline ki-trash"></i></a>
|
||||
';
|
||||
return $btn;
|
||||
})
|
||||
->addColumn('status', function($row){
|
||||
if ($row->is_status == GlobalEnum::isTicketSellerPending) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-dark text-dark">Pending</span>';
|
||||
} elseif($row->is_status == GlobalEnum::isTicketAdminReplied) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-primary text-primary">Admin Membalas</span>';
|
||||
} elseif($row->is_status == GlobalEnum::isTicketSellerClosed) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-danger text-danger">Ditutup</span>';
|
||||
}
|
||||
})
|
||||
->addColumn('priority', function($row){
|
||||
if ($row->is_priority == GlobalEnum::isTicketPriorityNormal) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-info text-info">Normal</span>';
|
||||
} elseif($row->is_priority == GlobalEnum::isTicketPriorityMedium) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-primary text-primary">Medium</span>';
|
||||
} elseif($row->is_priority == GlobalEnum::isTicketPriorityHigh) {
|
||||
return '<span class="mb-1 badge font-medium bg-light-danger text-danger">Tinggi</span>';
|
||||
}
|
||||
})
|
||||
->rawColumns(['title-post','action','status','priority'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Semua Tiket',
|
||||
'button' => true,
|
||||
'module' => [
|
||||
'url' => route('ticket.create'),
|
||||
'name' => 'Tambah baru'
|
||||
]
|
||||
];
|
||||
|
||||
return view('seller::ticket.index', compact('data'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Tambah Baru',
|
||||
];
|
||||
|
||||
return view('seller::ticket.add', compact('data'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'subject' => 'required',
|
||||
'message' => 'required',
|
||||
'is_priority' => 'required',
|
||||
]);
|
||||
|
||||
if($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator->errors());
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$ticket = new TicketModel([
|
||||
'id' => Str::uuid(),
|
||||
'user_id' => auth()->user()->id,
|
||||
'subject' => $input['subject'],
|
||||
'is_priority' => $input['is_priority'],
|
||||
'is_status' => 1
|
||||
]);
|
||||
|
||||
$check = TicketModel::where('subject', $ticket->subject)->count();
|
||||
|
||||
$ticketResponse = new TicketResponseModel();
|
||||
$ticketResponse->id = Str::uuid();
|
||||
$ticketResponse->id_ticket = $ticket->id; // Isi dengan nilai yang sesuai
|
||||
$ticketResponse->user_id = $ticket->user_id; // Isi dengan nilai yang sesuai
|
||||
$ticketResponse->message = clean($input['message']);
|
||||
|
||||
$postTicket = $ticket->save();
|
||||
$postTicketResponse = $ticketResponse->save();
|
||||
|
||||
if($check == 0) {
|
||||
if($postTicket && $postTicketResponse) {
|
||||
return redirect()->route('ticket')->with('swal', swal_alert('success', 'Anda berhasil membuka tiket baru.'));
|
||||
} else {
|
||||
return redirect()->route('ticket')->with('swal', swal_alert('error', 'Terjadi kesalahan saat membuka tiket.'));
|
||||
}
|
||||
} else {
|
||||
return redirect()->route('ticket')->with('swal', swal_alert('error', 'Ditemukan data yang telah ada'));
|
||||
}
|
||||
}
|
||||
|
||||
public function view($id)
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Ticket #' . explode('-', $id)[0],
|
||||
];
|
||||
|
||||
$ticketResponse = TicketModel::find($id)->responses;
|
||||
return view('seller::ticket.detail', compact('data', 'ticketResponse'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'subject' => 'required',
|
||||
'message' => 'required',
|
||||
'is_priority' => 'required',
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Listeners;
|
||||
|
||||
use Modules\Seller\Events\TicketCreated;
|
||||
use Modules\Seller\Entities\TicketResponseModel;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class TicketCreatedListener
|
||||
{
|
||||
public function handle(TicketCreated $event)
|
||||
{
|
||||
$ticket = $event->ticketResponse;
|
||||
|
||||
// Simpan data ke dalam TicketResponseModel
|
||||
$ticketResponse = new TicketResponseModel([
|
||||
'id' => Str::uuid(), // Generate UUID baru
|
||||
'id_ticket' => $ticket->id, // Gunakan ID tiket yang baru saja dibuat
|
||||
'user_id' => $ticket->user_id, // Isi dengan nilai yang sesuai
|
||||
'message' => $ticket->message, // Sesuaikan dengan data yang diperlukan
|
||||
]);
|
||||
|
||||
$ticketResponse->save();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Modules\Seller\Events\TicketCreated;
|
||||
use Modules\Seller\Listeners\TicketCreatedListener;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected $listen = [
|
||||
TicketCreated::class => [
|
||||
TicketCreatedListener::class,
|
||||
],
|
||||
];
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The module namespace to assume when generating URLs to actions.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $moduleNamespace = 'Modules\Seller\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('Seller', '/Routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('Seller', '/Routes/api.php'));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Seller\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Database\Eloquent\Factory;
|
||||
|
||||
class SellerServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* @var string $moduleName
|
||||
*/
|
||||
protected $moduleName = 'Seller';
|
||||
|
||||
/**
|
||||
* @var string $moduleNameLower
|
||||
*/
|
||||
protected $moduleNameLower = 'seller';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
$this->app->register(EventServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->publishes([
|
||||
module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'),
|
||||
], 'config');
|
||||
$this->mergeConfigFrom(
|
||||
module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||
|
||||
$sourcePath = module_path($this->moduleName, 'Resources/views');
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath
|
||||
], ['views', $this->moduleNameLower . '-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (\Config::get('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
return $paths;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
@include('components.theme.pages.header')
|
||||
|
||||
<section>
|
||||
<!-- basic table -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
{{ Form::open(['route' => 'rekening.store']) }}
|
||||
@csrf
|
||||
<div class="form-group mb-4">
|
||||
<label class="form-label">Atas Nama<sup class="text-danger">*</sup></label>
|
||||
<input type="text" name="name" value="{{ old('name') }}" autocomplete="off" class="form-control form-control-solid mt-2 {{ $errors->has('name') ? 'is-invalid' : '' }}" placeholder="Masukkan Atas Nama">
|
||||
@error('name') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="form-group mb-4">
|
||||
<label class="form-label">Nomer Rekening<sup class="text-danger">*</sup></label>
|
||||
<input type="number" name="account_number" value="{{ old('account_number') }}" autocomplete="off" class="form-control form-control-solid mt-2 {{ $errors->has('account_number') ? 'is-invalid' : '' }}" placeholder="Masukkan Nomor Rekening">
|
||||
@error('account_number') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="form-group mb-4">
|
||||
<label class="form-label">Daftar Bank<sup class="text-danger">*</sup></label>
|
||||
<select name="rid" class="form-select form-select-solid input-bank mt-2 {{ $errors->has('rid') ? 'is-invalid' : '' }}">
|
||||
@foreach ($listAllBank as $bank)
|
||||
@if (strlen($bank->kodebank) == 1)
|
||||
@php $code = '00' . $bank->kodebank @endphp
|
||||
@elseif(strlen($bank->kodebank) == 2)
|
||||
@php $code = '0' . $bank->kodebank @endphp
|
||||
@else
|
||||
@php $code = $bank->kodebank @endphp
|
||||
@endif
|
||||
<option value="{{ $bank->id }}">Kode Bank: {{ $code }} / {{ $bank->nama }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('rid') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="form-group mb-0">
|
||||
<button type="submit" class="btn btn-primary">Simpan</button>
|
||||
<a href="{{ route('rekening') }}" class="btn btn-light btn-light">Kembali</a>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@push('scripts')
|
||||
<script src="https://preview.keenthemes.com/html/metronic/docs/assets/plugins/custom/ckeditor/ckeditor-classic.bundle.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.input-bank').select2({
|
||||
placeholder: 'Pilih salah satu',
|
||||
dropdownParent: $('.input-bank').parent()
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,70 @@
|
|||
@include('components.theme.pages.header')
|
||||
|
||||
<section>
|
||||
<!-- basic table -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form action="{{ route('rekening.update', ['id' => $getDetailAccount->id]) }}" id="form-tag-update" method="POST">
|
||||
@csrf
|
||||
<div class="form-group mb-4">
|
||||
<label class="form-label">Atas Nama<sup class="text-danger">*</sup></label>
|
||||
<input type="text" name="name" value="{{ $getDetailAccount->name }}" autocomplete="off" class="form-control form-control-solid mt-2 {{ $errors->has('name') ? 'is-invalid' : '' }}" placeholder="Masukkan Atas Nama">
|
||||
@error('name') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="form-group mb-4">
|
||||
<label class="form-label">Nomer Rekening<sup class="text-danger">*</sup></label>
|
||||
<input type="number" name="account_number" value="{{ $getDetailAccount->account_number }}" autocomplete="off" class="form-control form-control-solid mt-2 {{ $errors->has('account_number') ? 'is-invalid' : '' }}" placeholder="Masukkan Nomor Rekening">
|
||||
@error('account_number') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="form-group mb-4">
|
||||
<label class="form-label">Daftar Bank<sup class="text-danger">*</sup></label>
|
||||
<select name="rid" class="form-select form-select-solid input-bank mt-2 {{ $errors->has('rid') ? 'is-invalid' : '' }}">
|
||||
@foreach ($listAllBank as $bank)
|
||||
@if (strlen($bank->kodebank) == 1)
|
||||
@php $code = '00' . $bank->kodebank @endphp
|
||||
@elseif(strlen($bank->kodebank) == 2)
|
||||
@php $code = '0' . $bank->kodebank @endphp
|
||||
@else
|
||||
@php $code = $bank->kodebank @endphp
|
||||
@endif
|
||||
<option value="{{ $bank->id }}">Kode Bank: {{ $code }} / {{ $bank->nama }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('rid') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="form-group mb-4">
|
||||
<label class="form-label">Status Rekening<sup class="text-danger">*</sup></label>
|
||||
<select name="is_active" class="form-select form-select-solid mt-2 {{ $errors->has('is_active') ? 'is-invalid' : '' }}">
|
||||
@foreach ([1,2] as $status)
|
||||
@php $name = $status == 1 ? 'Aktif' : 'Tidak Aktif' @endphp
|
||||
@php $selected = $status == $getDetailAccount->is_active ? 'selected' : '' @endphp
|
||||
<option value="{{ $status }}" {{ $selected }}>{{ $name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('is_active') <small class="text-danger">{{ $message }}</small> @enderror
|
||||
</div>
|
||||
<div class="form-group mb-0">
|
||||
<button type="submit" class="btn btn-primary">Perbarui</button>
|
||||
<a href="{{ route('rekening') }}" class="btn btn-light btn-light">Kembali</a>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@push('scripts')
|
||||
<script src="https://preview.keenthemes.com/html/metronic/docs/assets/plugins/custom/ckeditor/ckeditor-classic.bundle.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.input-bank').select2({
|
||||
placeholder: 'Pilih salah satu',
|
||||
dropdownParent: $('.input-bank').parent()
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,79 @@
|
|||
@push('css')
|
||||
<link href="{{ frontend('plugins/custom/datatables/datatables.bundle.css') }}" rel="stylesheet" type="text/css" />
|
||||
@endpush
|
||||
@include('components.theme.pages.header')
|
||||
|
||||
<section>
|
||||
<!-- basic table -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card card-flush">
|
||||
<div class="card-header flex-nowrap pt-5">
|
||||
<div>
|
||||
<div class="d-flex align-items-center position-relative my-1">
|
||||
<i class="ki-outline ki-magnifier fs-1 position-absolute ms-6"><span class="path1"></span><span class="path2"></span></i>
|
||||
<input type="text" id="search" class="form-control form-control-solid w-250px ps-15" placeholder="Temukan Rekening"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="data-table" class="table align-middle table-row-dashed fs-6 gy-5">
|
||||
<thead>
|
||||
<tr class="text-start text-gray-400 fw-bold fs-7 text-uppercase gs-0">
|
||||
<th>ID</th>
|
||||
<th>Nomor Rekening</th>
|
||||
<th>Atas Nama</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-gray-600 fw-semibold"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ frontend('plugins/custom/datatables/datatables.bundle.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var table = $('#data-table').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: "{{ route('rekening') }}",
|
||||
order: [[5, 'desc']],
|
||||
stateSave: true,
|
||||
columns: [
|
||||
{data: null, name: 'id'},
|
||||
{data: 'title-post', name: 'title-post'},
|
||||
{data: 'name', name: 'name'},
|
||||
{data: 'status', name: 'status'},
|
||||
{data: 'action', name: 'action', orderable: false, searchable: false},
|
||||
],
|
||||
createdRow: function (row, data, dataIndex) {
|
||||
// Set the sequential number starting from 1
|
||||
$('td', row).eq(0).html(dataIndex + 1);
|
||||
}
|
||||
});
|
||||
|
||||
// #myInput is a <input type="text"> element
|
||||
$('#search').on('keyup change', function () {
|
||||
table.search(this.value).draw();
|
||||
});
|
||||
|
||||
$('#data-table').on('click', '.deleteContent', function() {
|
||||
var url = $(this).data('url');
|
||||
$('#exampleModal').modal('show', {
|
||||
backdrop: 'static'
|
||||
});
|
||||
$('.link').attr('href', url)
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,171 @@
|
|||
@include('components.theme.pages.header')
|
||||
|
||||
<section>
|
||||
<!-- basic table -->
|
||||
{{ Form::open(['route' => 'withdrawal.store', 'id' => 'form-deposit']) }}
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h6 class="card-title">Formulir Tarik Tunai</h6>
|
||||
<div class="card-toolbar">
|
||||
<i class="ki-duotone ki-information-2 fs-2" data-bs-toggle="tooltip" data-bs-placement="top" title="Tolong dilengkapi data informasi dengan valid">
|
||||
<span class="path1"></span>
|
||||
<span class="path2"></span>
|
||||
<span class="path3"></span>
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex flex-column fv-row">
|
||||
<label class="d-flex align-items-center fs-6 fw-semibold mb-4">
|
||||
<span class="required">Opsi</span>
|
||||
<span class="ms-1" data-bs-toggle="tooltip" title="Pilih salah satu">
|
||||
<i class="ki-duotone ki-information text-gray-500 fs-7"><span class="path1"></span><span class="path2"></span><span class="path3"></span></i>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<div class="d-flex flex-stack gap-5 mb-4">
|
||||
<button type="button" class="btn btn-light-primary w-100 pick-amount" data-kt-docs-advanced-forms="interactive" data-amount="10000">10000</button>
|
||||
<button type="button" class="btn btn-light-primary w-100 pick-amount" data-kt-docs-advanced-forms="interactive" data-amount="50000">50000</button>
|
||||
<button type="button" class="btn btn-light-primary w-100 pick-amount" data-kt-docs-advanced-forms="interactive" data-amount="100000">100000</button>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="action" value=""/>
|
||||
<input type="number" class="form-control form-control-solid py-5" placeholder="Masukkan Jumlah" name="amount" />
|
||||
</div>
|
||||
<div class="form-group mt-4 mb-0">
|
||||
<button type="button" class="btn btn-primary w-100 btnDeposit">Proses</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h6 class="card-title">Ringkasan</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group mb-3">
|
||||
<label class="form-label pb-1">Rekening</label>
|
||||
<select class="form-select form-select-solid form-select-sm mb-1 input-bayar" name="is_account">
|
||||
@foreach($getListOfBank as $bank)
|
||||
<option value="{{ $bank->id }}">{{ $bank->account_number . ' (' . $bank->name . ')' }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="d-flex list-group-item px-0 pb-3">
|
||||
<span class="fw-bold">Saldo <i class="ki-outline ki-information-2 fs-9 ms-1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Saldo anda tersedia senilai {{ 'Rp. ' . number_format(user()->income, 0, ',', '.') }}"></i></span>
|
||||
<span class="ms-auto">{{ rupiah_changer(user()->income) }}</span>
|
||||
</li>
|
||||
<li class="d-flex list-group-item px-0 pb-3 pt-3">
|
||||
<span class="fw-bold">Nominal Ditarik</span>
|
||||
<span class="ms-auto amount">0</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</section>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.input-bayar').select2({
|
||||
placeholder: 'Pilih salah satu',
|
||||
})
|
||||
const options = document.querySelectorAll('[data-kt-docs-advanced-forms="interactive"]');
|
||||
const inputEl = document.querySelector('[name="amount"]');
|
||||
options.forEach(option => {
|
||||
option.addEventListener('click', e => {
|
||||
e.preventDefault();
|
||||
inputEl.value = e.target.innerText;
|
||||
|
||||
const amount = parseInt(e.target.innerText);
|
||||
var formatAmount = new Intl.NumberFormat('id-ID', {
|
||||
style: 'currency',
|
||||
currency: 'IDR'
|
||||
}).format(amount);
|
||||
$('.amount').html(formatAmount.replace(/,00/g, ''));
|
||||
});
|
||||
});
|
||||
|
||||
$('input[name=amount]').change(function() {
|
||||
const amount = parseInt($(this).val());
|
||||
var formatAmount = new Intl.NumberFormat('id-ID', {
|
||||
style: 'currency',
|
||||
currency: 'IDR'
|
||||
}).format(amount);
|
||||
$('.amount').html(formatAmount.replace(/,00/g, ''));
|
||||
});
|
||||
|
||||
$('.btnDeposit').click(function() {
|
||||
if($('input[name=amount]').val() === '' && $('.input-bayar').val() === '') {
|
||||
Swal.fire({
|
||||
text: "Nominal dan rekening tidak boleh kosong",
|
||||
icon: "error"
|
||||
});
|
||||
} else {
|
||||
$(this).attr('disabled', 'disabled');
|
||||
$(this).html(`
|
||||
<div class="spinner-border text-white mb-n1" role="status">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
`);
|
||||
|
||||
const amount = $('input[name=amount]').val();
|
||||
var amountBalance = new Intl.NumberFormat('id-ID', {
|
||||
style: 'currency',
|
||||
currency: 'IDR'
|
||||
}).format(amount).replace(/,00/g, '');
|
||||
|
||||
$('#transaksiModal').modal('show', {
|
||||
backdrop: 'static'
|
||||
});
|
||||
$('#transaksiModalLabel').html('Konfirmasi Penarikan Tunai');
|
||||
$('.result').html(`
|
||||
<div class="d-flex flex-stack">
|
||||
<div class="text-gray-700 fw-semibold fs-6 me-2">Nominal yang akan ditarik</div>
|
||||
<div class="d-flex align-items-senter">
|
||||
<i class="ki-outline ki-arrow-up-right fs-2 text-success me-2"></i>
|
||||
<span class="text-gray-900 fw-bolder fs-6">${amountBalance}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="separator separator-dashed my-3"></div>
|
||||
<div class="d-flex flex-stack">
|
||||
<div class="text-gray-700 fw-semibold fs-6 me-2">Saldo tersedia</div>
|
||||
<div class="d-flex align-items-senter">
|
||||
<i class="ki-outline ki-arrow-down-right fs-2 text-danger me-2"></i>
|
||||
<span class="text-gray-900 fw-bolder fs-6">{{ 'Rp. ' . number_format(user()->income, 0, ',', '.') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
|
||||
$('.buttonOrder').html(`
|
||||
<button class="btn btn-outline btn-primary me-2 placeDeposit" data-button="tarik-sekarang" type="button">Tarik Sekarang</button>
|
||||
<button class="btn btn-outline btn-outline-dashed me-2" data-bs-dismiss="modal" type="button">Batal</button>
|
||||
`);
|
||||
|
||||
setTimeout(() => {
|
||||
$(this).removeAttr('disabled');
|
||||
$(this).html('Proses');
|
||||
}, 4000);
|
||||
}
|
||||
|
||||
$('.placeDeposit').click(function() {
|
||||
const action = $(this).data('button');
|
||||
if(action === "tarik-sekarang") {
|
||||
$('input[name=action]').val(1);
|
||||
$('#form-deposit').submit();
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,144 @@
|
|||
@if($payment->is_status == 1)
|
||||
@section('additional')
|
||||
<div class="card-toolbar">
|
||||
<button class="btn btn-sm btn-light-danger border border-dotted cancelOrder" data-invoice="{{ $payment->id }}">Batalkan</button>
|
||||
</div>
|
||||
@endsection
|
||||
@elseif($payment->is_status == 3)
|
||||
@section('additional')
|
||||
<div class="card-toolbar">
|
||||
<button class="btn btn-sm btn-light-primary border border-dotted viewPayment" data-payment="{{ $payment->is_attachment }}">Bukti Pembayaran</button>
|
||||
</div>
|
||||
@endsection
|
||||
@endif
|
||||
@include('components.theme.pages.header')
|
||||
<section class="invoice">
|
||||
<div class="row">
|
||||
<div class="col-md-7 mb-5">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Informasi</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex flex-stack">
|
||||
<div class="text-gray-700 fw-semibold fs-6 me-2">Secure Code</div>
|
||||
<span class="text-gray-900 fw-bolder fs-6">{{ $payment->id }}</span>
|
||||
</div>
|
||||
|
||||
<div class="separator separator-dashed my-3"></div>
|
||||
<div class="d-flex flex-stack">
|
||||
<div class="text-gray-700 fw-semibold fs-6 me-2">Invoice ID</div>
|
||||
<span class="text-gray-900 fw-bolder fs-6">{{ $payment->invoice_id }}</span>
|
||||
</div>
|
||||
|
||||
<div class="separator separator-dashed my-3"></div>
|
||||
<div class="d-flex flex-stack">
|
||||
<div class="text-gray-700 fw-semibold fs-6 me-2">Nominal Deposit</div>
|
||||
<div class="d-flex align-items-senter">
|
||||
<i class="ki-outline ki-arrow-up-right fs-2 text-success me-2"></i>
|
||||
<span class="text-gray-900 fw-bolder fs-6">{{ 'Rp ' . number_format($payment->amount, 0, ',', '.') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="separator separator-dashed my-3"></div>
|
||||
<div class="d-flex flex-stack">
|
||||
<div class="text-gray-700 fw-semibold fs-6 me-2">Terakhir Diperbarui</div>
|
||||
<span class="text-gray-900 fw-bolder fs-6">{{ date_formatting($payment->updated_at, 'timeago') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5 mb-5">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Tambahan</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex flex-stack">
|
||||
<div class="text-gray-700 fw-semibold fs-6 me-2">Status</div>
|
||||
<span class="fs-6">
|
||||
@if ($payment->is_status == enum('isWithdrawPending'))
|
||||
<span class="badge badge-light-dark">Menunggu Pembayaran</span>
|
||||
@elseif($payment->is_status == enum('isWithdrawOnProgress'))
|
||||
<span class="badge badge-light-info">Sedang Proses</span>
|
||||
@elseif($payment->is_status == enum('isWithdrawPaid'))
|
||||
<span class="badge badge-light-success">Telah dibayarkan</span>
|
||||
@elseif($payment->is_status == enum('isWithdrawCancel'))
|
||||
<span class="badge badge-light-danger">Dibatalkan</span>
|
||||
@endif
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="separator separator-dashed my-3"></div>
|
||||
<div class="d-flex flex-stack">
|
||||
<div class="text-gray-700 fw-semibold fs-6 me-2">Invoice Dibuat</div>
|
||||
<span class="text-gray-900 fw-bolder fs-6">{{ date('Y-m-d', strtotime($payment->created_at)) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="separator separator-dashed my-3"></div>
|
||||
<div class="d-flex flex-stack">
|
||||
<div class="text-gray-700 fw-semibold fs-6 me-2">Metode</div>
|
||||
<span class="text-gray-900 fw-bolder fs-6">
|
||||
@php
|
||||
$checkBank = \Modules\Seller\Entities\RekeningBankModel::where('id', $payment->rekening->first()->rid)->first();
|
||||
@endphp
|
||||
{{ $checkBank->nama }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="separator separator-dashed my-3"></div>
|
||||
<div class="d-flex flex-stack">
|
||||
<div class="text-gray-700 fw-semibold fs-6 me-2">Issued By</div>
|
||||
<span class="text-gray-900 fw-bolder fs-6">{{ user()->name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@push('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.input-bayar').select2({
|
||||
placeholder: 'Pilih salah satu',
|
||||
});
|
||||
|
||||
$('.cancelOrder').click(function() {
|
||||
Swal.fire({
|
||||
title: 'Apakah anda?',
|
||||
text: "Anda tidak akan dapat mengembalikan ini!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: 'btn btn-primary',
|
||||
cancelButtonColor: 'btn btn-danger',
|
||||
confirmButtonText: 'Ya, Batalkan!',
|
||||
cancelButtonText: 'Batal'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
Swal.fire(
|
||||
'Dibatalkan!',
|
||||
'Anda membatalkan transaksi ini.',
|
||||
'success'
|
||||
)
|
||||
|
||||
setTimeout(() => {
|
||||
window.location.href = "{{ site_url('seller', 'account/withdrawal/c') }}/" + $(this).data('invoice');
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
@if($payment->is_status == enum('isWithdrawPaid'))
|
||||
$('.viewPayment').on('click', () => {
|
||||
$('#viewerModal').modal('show');
|
||||
$('.result').html(`
|
||||
<div class="">
|
||||
<img src="{{ assets_url($payment->is_attachment) }}" class="img-responsive w-100">
|
||||
</div>
|
||||
`);
|
||||
})
|
||||
@endif
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,182 @@
|
|||
@push('css')
|
||||
<link href="{{ frontend('plugins/custom/datatables/datatables.bundle.css') }}" rel="stylesheet" type="text/css" />
|
||||
@endpush
|
||||
@include('components.theme.pages.header')
|
||||
|
||||
<section>
|
||||
<!-- basic table -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card card-flush">
|
||||
<div class="card-header flex-nowrap pt-5">
|
||||
<div>
|
||||
<div class="d-flex align-items-center position-relative my-1">
|
||||
<i class="ki-outline ki-magnifier fs-1 position-absolute ms-6"><span class="path1"></span><span class="path2"></span></i>
|
||||
<input type="text" id="search" class="form-control form-control-solid w-250px ps-15" placeholder="Temukan Invoice"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-toolbar">
|
||||
<!--begin::Menu-->
|
||||
<button class="btn btn-light-primary btn-active-light-primary justify-content-end"
|
||||
data-kt-menu-trigger="click" data-kt-menu-placement="bottom-end"
|
||||
data-kt-menu-overflow="true">
|
||||
<i class="ki-outline ki-filter fs-1 me-n1"></i>
|
||||
<span class="mb-0">Filter</span>
|
||||
</button>
|
||||
|
||||
<div class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-800 menu-state-bg-light-primary fw-semibold w-300px"
|
||||
data-kt-menu="true">
|
||||
<div class="menu-item px-3">
|
||||
<div class="menu-content fs-6 text-dark fw-bold px-3 py-4">Filter By</div>
|
||||
</div>
|
||||
<div class="separator mb-3 opacity-75"></div>
|
||||
<div class="px-7 py-5 menu-item" data-kt-docs-table-filter="status_type">
|
||||
<div class="form-check form-check-custom form-check-solid mb-3">
|
||||
<input class="form-check-input" name="status" type="radio" value="1" id="flexRadioDefault"/>
|
||||
<label class="form-check-label" for="flexRadioDefault">
|
||||
Menunggu Diproses
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check form-check-custom form-check-solid mb-3">
|
||||
<input class="form-check-input" name="status" type="radio" value="2" id="flexRadioDefault"/>
|
||||
<label class="form-check-label" for="flexRadioDefault">
|
||||
Sedang Proses
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check form-check-custom form-check-solid mb-3">
|
||||
<input class="form-check-input" name="status" type="radio" value="3" id="flexRadioDefault"/>
|
||||
<label class="form-check-label" for="flexRadioDefault">
|
||||
Dibayarkan
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end py-3">
|
||||
<button type="reset" class="btn btn-light btn-active-light-primary me-2" data-kt-menu-dismiss="true" data-kt-docs-table-filter="reset">Atur Ulang</button>
|
||||
<button type="submit" class="btn btn-primary" data-kt-menu-dismiss="true" data-kt-docs-table-filter="filter">Terapkan</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="data-table" class="table align-middle table-row-dashed fs-6 gy-5">
|
||||
<thead>
|
||||
<tr class="text-start text-gray-400 fw-bold fs-7 text-uppercase gs-0">
|
||||
<th>Invoice ID</th>
|
||||
<th>Nominal</th>
|
||||
<th>Metode</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-gray-600 fw-semibold"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ frontend('plugins/custom/datatables/datatables.bundle.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var filterStatus;
|
||||
|
||||
var table = $('#data-table').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: "{{ site_url('seller', 'account/withdrawal') }}",
|
||||
stateSave: true,
|
||||
columns: [
|
||||
{data: 'invoice-number', name: 'invoice-number'},
|
||||
{data: 'price', name: 'price'},
|
||||
{data: 'account', name: 'account'},
|
||||
{data: 'status', name: 'status'},
|
||||
{data: null}
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
targets: -1,
|
||||
data: null,
|
||||
orderable: false,
|
||||
render: function (data, type, row) {
|
||||
return `
|
||||
<a href="#" class="btn btn-light btn-active-light-primary btn-sm" data-kt-menu-trigger="click" data-kt-menu-placement="bottom-end" data-kt-menu-flip="top-end">
|
||||
Aksi
|
||||
</a>
|
||||
<!--begin::Menu-->
|
||||
<div class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-600 menu-state-bg-light-primary fw-bold fs-7 w-125px py-4" data-kt-menu="true">
|
||||
<!--begin::Menu item-->
|
||||
<div class="menu-item px-3">
|
||||
<a href="{{ site_url('seller', 'account/withdrawal/v') }}/${row.id}" class="menu-link px-3 viewContent">
|
||||
Detail
|
||||
</a>
|
||||
</div>
|
||||
<!--end::Menu item-->
|
||||
</div>
|
||||
<!--end::Menu-->
|
||||
`;
|
||||
},
|
||||
}
|
||||
],
|
||||
});
|
||||
|
||||
// Filter Datatable
|
||||
var handleFilterDatatable = () => {
|
||||
// Select filter options
|
||||
filterStatus = document.querySelectorAll('[data-kt-docs-table-filter="status_type"] [name="status"]');
|
||||
const filterButton = document.querySelector('[data-kt-docs-table-filter="filter"]');
|
||||
|
||||
// Filter datatable on submit
|
||||
filterButton.addEventListener('click', function () {
|
||||
let statusValue = 'status|';
|
||||
filterStatus.forEach(r => {
|
||||
if (r.checked) {
|
||||
statusValue = 'status|' + r.value;
|
||||
}
|
||||
|
||||
if (statusValue === 'status|') {
|
||||
statusValue = 'status|';
|
||||
}
|
||||
});
|
||||
|
||||
table.search(statusValue).draw();
|
||||
});
|
||||
}
|
||||
|
||||
// Reset Filter
|
||||
var handleResetForm = () => {
|
||||
const resetButton = document.querySelector('[data-kt-docs-table-filter="reset"]');
|
||||
resetButton.addEventListener('click', function () {
|
||||
filterStatus[0].checked = true;
|
||||
table.search('').draw();
|
||||
});
|
||||
}
|
||||
|
||||
table.on('draw', function () {
|
||||
handleFilterDatatable();
|
||||
handleResetForm();
|
||||
KTMenu.createInstances();
|
||||
});
|
||||
|
||||
table.search('').draw();
|
||||
|
||||
// #myInput is a <input type="text"> element
|
||||
$('#search').on('keyup change', function () {
|
||||
table.search('invoice|' + this.value).draw();
|
||||
});
|
||||
|
||||
$('#data-table').on('click', '.deleteContent', function() {
|
||||
var url = $(this).data('url');
|
||||
$('#exampleModal').modal('show', {
|
||||
backdrop: 'static'
|
||||
});
|
||||
$('.link').attr('href', url)
|
||||
})
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@include('components.theme.pages.footer')
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue