feat: user announcement
chore: change from media announcement to user announcement
This commit is contained in:
parent
aca0df9828
commit
46261e7412
@ -166,10 +166,10 @@ function slugify($param) {
|
||||
function get_unread_announcements() {
|
||||
$user = User::findOrFail(Auth::id());
|
||||
if($user->role_id === 3){
|
||||
$mediaId = $user->company->media->id;
|
||||
$userId = $user->id;
|
||||
|
||||
$media = Media::with('announcements')->findOrFail($mediaId);
|
||||
return $media->announcements()
|
||||
$user = User::with('announcements')->findOrFail($userId);
|
||||
return $user->announcements()
|
||||
->wherePivot('status', '=', '0')
|
||||
->count();
|
||||
|
||||
|
||||
@ -6,27 +6,30 @@
|
||||
use App\Http\Requests\AnnouncementRequest;
|
||||
use App\Models\Announcement;
|
||||
use App\Models\Media;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class AnnouncementController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
public function index(Request $request){
|
||||
|
||||
$category = $request->input('category', 'general');
|
||||
$data = [
|
||||
'title' => 'Pengumuman',
|
||||
'category' => $category
|
||||
];
|
||||
if(is_role(['1'])){
|
||||
return view('dashboard.announcements.index', [
|
||||
'title' => 'Pengumuman'
|
||||
]);
|
||||
return view('dashboard.announcements.index', $data);
|
||||
}else if(is_role(['3'])){
|
||||
return view('dashboard.announcements.media.index', [
|
||||
'title' => 'Pengumuman'
|
||||
]);
|
||||
return view('dashboard.announcements.media.index', $data);
|
||||
}
|
||||
}
|
||||
|
||||
public function create(){
|
||||
return view('dashboard.announcements.create', [
|
||||
'title' => 'Tambah Pengumuman',
|
||||
'media' => Media::all()
|
||||
'users' => User::all()
|
||||
]);
|
||||
}
|
||||
|
||||
@ -34,24 +37,28 @@ public function store(AnnouncementRequest $request){
|
||||
$validatedData = $request->validated();
|
||||
$validatedData['enhancer_id'] = Auth::id();
|
||||
|
||||
$announcement = Announcement::create($validatedData);
|
||||
$announcement->media()->attach($validatedData['media_ids']);
|
||||
if($request->hasFile('attachment')){
|
||||
$validatedData['attachment'] = store_file($validatedData['attachment'], '/uploads/announcements', 'public')['randomFileName'];
|
||||
}
|
||||
|
||||
if ($announcement->media()->count() > 0) {
|
||||
return redirect()->back()->with('success-status', 'Berhasil membuat pengumuman.');
|
||||
$announcement = Announcement::create($validatedData);
|
||||
$announcement->users()->attach($validatedData['user_ids']);
|
||||
|
||||
if ($announcement->users()->count() > 0) {
|
||||
return redirect()->route('dashboard.announcements.index')->with('success-status', 'Berhasil membuat pengumuman.');
|
||||
} else {
|
||||
return redirect()->back()->with('failed-status', 'Gagal membuat pengumuman');
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id){
|
||||
$announcement = Announcement::with(['media'])->findOrFail(decrypt_id($id));
|
||||
$announcement = Announcement::with(['users'])->findOrFail(decrypt_id($id));
|
||||
|
||||
return view('dashboard.announcements.edit', [
|
||||
'title' => 'Tambah Pengumuman',
|
||||
'announcement' => $announcement,
|
||||
'media' => Media::all(),
|
||||
'selectedMediaIds' => $announcement->media->pluck('id')->toArray()
|
||||
'users' => User::all(),
|
||||
'selectedUsersIds' => $announcement->users->pluck('id')->toArray()
|
||||
]);
|
||||
}
|
||||
|
||||
@ -59,19 +66,26 @@ public function update(AnnouncementRequest $request, $id){
|
||||
$validatedData = $request->validated();
|
||||
$validatedData['enhancer_id'] = Auth::id();
|
||||
|
||||
$announcement = Announcement::with(['media'])->findOrFail(decrypt_id($id));
|
||||
$announcement = Announcement::with(['users'])->findOrFail(decrypt_id($id));
|
||||
|
||||
$announcement->update($validatedData);
|
||||
if ($request->has('media_ids')) {
|
||||
$mediaData = [];
|
||||
foreach ($validatedData['media_ids'] as $mediaId) {
|
||||
$mediaData[$mediaId] = ['status' => '0'];
|
||||
}
|
||||
|
||||
$announcement->media()->sync($mediaData);
|
||||
if($request->hasFile('attachment')){
|
||||
$validatedData['attachment'] = store_file($validatedData['attachment'], '/uploads/announcements', 'public')['randomFileName'];
|
||||
delete_file('app/public/uploads/announcements/'.$announcement->attachment);
|
||||
}else{
|
||||
$validatedData['attachment'] = $announcement->attachment;
|
||||
}
|
||||
|
||||
if ($announcement->media()->count() > 0) {
|
||||
$announcement->update($validatedData);
|
||||
if ($request->has('user_ids')) {
|
||||
$mediaData = [];
|
||||
foreach ($validatedData['user_ids'] as $userId) {
|
||||
$mediaData[$userId] = ['status' => '0'];
|
||||
}
|
||||
|
||||
$announcement->users()->sync($mediaData);
|
||||
}
|
||||
|
||||
if ($announcement->users()->count() > 0) {
|
||||
return redirect()->back()->with('success-status', 'Berhasil mengubah pengumuman.');
|
||||
} else {
|
||||
return redirect()->back()->with('failed-status', 'Gagal mengubah pengumuman');
|
||||
@ -79,7 +93,9 @@ public function update(AnnouncementRequest $request, $id){
|
||||
}
|
||||
|
||||
public function show($id){
|
||||
$announcement = Announcement::with(['media'])->findOrFail(decrypt_id($id));
|
||||
$announcement = Announcement::with(['users' => function($query) {
|
||||
$query->withPivot('category');
|
||||
}])->findOrFail(decrypt_id($id));
|
||||
|
||||
return view('dashboard.announcements.show', [
|
||||
'title' => 'Detail Pengumuman',
|
||||
@ -88,14 +104,14 @@ public function show($id){
|
||||
}
|
||||
|
||||
public function read($id){
|
||||
$announcement = Announcement::with(['media'])->findOrFail(decrypt_id($id));
|
||||
$announcement = Announcement::with(['users'])->findOrFail(decrypt_id($id));
|
||||
|
||||
$mediaId = Auth::user()->company->media->id;
|
||||
if(!in_array($mediaId, $announcement->media->pluck('id')->toArray())){
|
||||
$userid = Auth::user()->id;
|
||||
if(!in_array($userid, $announcement->users->pluck('id')->toArray())){
|
||||
abort(404, "Pengumuman tidak ditemukan.");
|
||||
}
|
||||
|
||||
$announcement->media()->updateExistingPivot($mediaId, [
|
||||
$announcement->users()->updateExistingPivot($userid, [
|
||||
'status' => '1',
|
||||
]);
|
||||
|
||||
@ -107,9 +123,9 @@ public function read($id){
|
||||
|
||||
public function destroy($id){
|
||||
try {
|
||||
$announcement = Announcement::with(['media'])->findOrFail(decrypt_id($id));
|
||||
$announcement = Announcement::with(['users'])->findOrFail(decrypt_id($id));
|
||||
|
||||
$announcement->media()->detach();
|
||||
$announcement->users()->detach();
|
||||
|
||||
$announcement->delete();
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\CooperationCompletionRequest;
|
||||
use App\Models\Announcement;
|
||||
use App\Models\Cooperation;
|
||||
use App\Models\CooperationCompletion;
|
||||
use Illuminate\Http\Request;
|
||||
@ -48,6 +49,16 @@ public function accept($id){
|
||||
'status' => '1'
|
||||
]);
|
||||
|
||||
// Announcements
|
||||
$announcementData = [
|
||||
'headline' => 'Formulir penyelesaian kerjasama <u>'. $completion->order->cooperation->name .'</u> telah <span class="text-primary">disetujui</span>',
|
||||
'content' => '<p>Admin telah menyetujui laporan formulir penyelesaian kerjasama Anda.</p>',
|
||||
'enhancer_id' => Auth::id()
|
||||
];
|
||||
$createdAnnouncement = Announcement::create($announcementData);
|
||||
$createdAnnouncement->users()->attach($completion->media->company->user->id, ['category' => 'system']);
|
||||
// End Announcements
|
||||
|
||||
if ($acceptedCompletion) {
|
||||
return redirect()->back()->with('success-status', 'Berhasil menyetujui penyelesaian kerjasama.');
|
||||
} else {
|
||||
@ -81,6 +92,16 @@ public function rejectAction(Request $request, $mediaOrderId, $id){
|
||||
'rejection_reason' => $validatedData['rejection_reason']
|
||||
]);
|
||||
|
||||
// Announcements
|
||||
$announcementData = [
|
||||
'headline' => 'Formulir penyelesaian kerjasama <u>'. $completion->order->cooperation->name .'</u> telah <span class="text-danger">ditolak</span>',
|
||||
'content' => '<p>Admin telah menolak laporan formulir penyelesaian kerjasama Anda.</p>',
|
||||
'enhancer_id' => Auth::id()
|
||||
];
|
||||
$createdAnnouncement = Announcement::create($announcementData);
|
||||
$createdAnnouncement->users()->attach($completion->media->company->user->id, ['category' => 'system']);
|
||||
// End Announcements
|
||||
|
||||
if ($rejectedCompletion) {
|
||||
return redirect()->back()->with('success-status', 'Berhasil menolak penyelesaian kerjasama.');
|
||||
} else {
|
||||
|
||||
@ -4,8 +4,10 @@
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\JournalistCooperationProposalRequest;
|
||||
use App\Models\Announcement;
|
||||
use App\Models\Cooperation;
|
||||
use App\Models\CooperationProposal;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
@ -62,15 +64,27 @@ public function accept(Request $request, $id){
|
||||
return abort(404, 'Media not found for the cooperation.');
|
||||
}
|
||||
|
||||
|
||||
// dd($mediaCooperation->pivot);
|
||||
|
||||
// Pastikan data yang ingin diperbarui ada dan statusnya belum '3'
|
||||
if ($mediaCooperation->pivot->status == '0') {
|
||||
$affectedRows = $cooperation->media()->updateExistingPivot($mediaCooperation->id, [
|
||||
'status' => '1',
|
||||
]);
|
||||
|
||||
// Announcements
|
||||
$announcementData = [
|
||||
'headline' => 'Ajuan Kerjasama <u>'.$cooperation->name.'</u> <span class="text-primary">diterima</span> oleh media <u>'.$mediaCooperation->name. '</u>',
|
||||
'content' => '<p>Ajuan Kerjasama <u>'.$cooperation->name.'</u> telah <span class="text-primary">diterima</span> oleh media <u>'.$mediaCooperation->name.'</u></p>',
|
||||
'enhancer_id' => Auth::id()
|
||||
];
|
||||
|
||||
$adminIds = User::where('role_id', 1)->pluck('id')->mapWithKeys(function ($id) {
|
||||
return [$id => ['category' => 'system']];
|
||||
})->toArray();
|
||||
|
||||
$createdAnnouncement = Announcement::create($announcementData);
|
||||
$createdAnnouncement->users()->attach($adminIds);
|
||||
// End Announcements
|
||||
|
||||
if ($affectedRows > 0) {
|
||||
return redirect()->back()->with('success-status', 'Berhasil menerima kerjasama.');
|
||||
} else {
|
||||
@ -99,6 +113,8 @@ public function createProposal($id){
|
||||
|
||||
public function storeProposal(JournalistCooperationProposalRequest $request, $id){
|
||||
$validatedData = $request->validated();
|
||||
|
||||
$cooperation = Cooperation::findOrFail(decrypt_id($id));
|
||||
$validatedData['cooperation_id'] = decrypt_id($id);
|
||||
$validatedData['media_id'] = Auth::user()->company->media->id;
|
||||
$validatedData['attachment'] = store_file($validatedData['attachment'], '/uploads/cooperation-proposals', 'public')['randomFileName'];
|
||||
@ -106,6 +122,21 @@ public function storeProposal(JournalistCooperationProposalRequest $request, $id
|
||||
$createdCooperationProposal = CooperationProposal::create($validatedData);
|
||||
$createdCooperationProposal->journalists()->attach($validatedData['journalist_ids']);
|
||||
|
||||
// Announcements
|
||||
$announcementData = [
|
||||
'headline' => 'Media <u>'.Auth::user()->company->media->name.'</u> telah mengirimkan formulir pengajuan kerjasama <u>'.$cooperation->name. '</u>',
|
||||
'content' => 'Media <u>'.Auth::user()->company->media->name.'</u> telah mengirimkan formulir pengajuan kerjasama <u>'.$cooperation->name. '</u> pada <b>'.idn_date($createdCooperationProposal->created_at, 'l, d F Y H:i').'</b>',
|
||||
'enhancer_id' => Auth::id()
|
||||
];
|
||||
|
||||
$adminIds = User::where('role_id', 1)->pluck('id')->mapWithKeys(function ($id) {
|
||||
return [$id => ['category' => 'system']];
|
||||
})->toArray();
|
||||
|
||||
$createdAnnouncement = Announcement::create($announcementData);
|
||||
$createdAnnouncement->users()->attach($adminIds);
|
||||
// End Announcements
|
||||
|
||||
if ($createdCooperationProposal->journalists()->count() > 0) {
|
||||
return redirect()->route('dashboard.cooperations.requests.index')->with('success-status', 'Berhasil melakukan pengajuan kerjasama.');
|
||||
} else {
|
||||
@ -156,6 +187,23 @@ public function rejectAction(Request $request, $id){
|
||||
'rejection_reason' => $validatedData['rejection_reason'],
|
||||
]);
|
||||
|
||||
// Announcements
|
||||
$announcementData = [
|
||||
'headline' => 'Ajuan Kerjasama <u>'.$cooperation->name.'</u> <span class="text-danger fw-bold">ditolak</span> oleh media <u>'.$mediaCooperation->name. '</u>',
|
||||
'content' => '<p>Ajuan Kerjasama <u>'.$cooperation->name.'</u> <span class="text-danger">ditolak</span> oleh media <u>'.$mediaCooperation->name.'</u></p>
|
||||
<p>Alasan: <br> '.$validatedData['rejection_reason'].'</p>
|
||||
',
|
||||
'enhancer_id' => Auth::id()
|
||||
];
|
||||
|
||||
$adminIds = User::where('role_id', 1)->pluck('id')->mapWithKeys(function ($id) {
|
||||
return [$id => ['category' => 'system']];
|
||||
})->toArray();
|
||||
|
||||
$createdAnnouncement = Announcement::create($announcementData);
|
||||
$createdAnnouncement->users()->attach($adminIds);
|
||||
// End Announcements
|
||||
|
||||
if ($affectedRows > 0) {
|
||||
return redirect()->back()->with('success-status', 'Berhasil menolak kerjasama.');
|
||||
} else {
|
||||
|
||||
@ -402,19 +402,33 @@ public function news(Request $request){
|
||||
|
||||
}
|
||||
|
||||
public function announcement(Request $request){
|
||||
public function announcement(Request $request, $category){
|
||||
if ($request->ajax()) {
|
||||
$data = Announcement::whereHas('media', function ($query) {
|
||||
$query->where('announcements_media.category', 'general');
|
||||
})->get();
|
||||
$data = Announcement::whereHas('users', function ($query) use ($category){
|
||||
$query->where('announcements_users.category', $category);
|
||||
})
|
||||
->where(function ($query) {
|
||||
$query->whereHas('users', function ($query) {
|
||||
$query->where('announcements_users.category', '!=', 'system');
|
||||
})
|
||||
->orWhere('enhancer_id', '!=', Auth::id());
|
||||
})
|
||||
->get();
|
||||
|
||||
|
||||
return DataTables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('sent_at', function ($data) {
|
||||
return idn_date($data->created_at, 'l, d F Y');
|
||||
->addColumn('sender', function ($data) use ($category) {
|
||||
if ($category === 'system') {
|
||||
return '<span class="badge bg-warning" style="display:inline-block;font-size:0.8rem;">Sistem</span>';
|
||||
}else{
|
||||
return '<span class="badge bg-primary" style="display:inline-block;font-size:0.8rem;">Admin</span>';
|
||||
}
|
||||
})
|
||||
->addColumn('action', function ($data) {
|
||||
->addColumn('sent_at', function ($data) {
|
||||
return idn_date($data->created_at, 'l, d F Y H:i');
|
||||
})
|
||||
->addColumn('action', function ($data) use ($category){
|
||||
$showUrl = route('dashboard.announcements.show', ['id' => encrypt_id($data->id)]);
|
||||
|
||||
$editUrl = route('dashboard.announcements.edit', ['id' => encrypt_id($data->id)]);
|
||||
@ -424,14 +438,19 @@ public function announcement(Request $request){
|
||||
$dropdown = '<div class="dropdown" style="display:flex; justify-content:center;">
|
||||
<a class="dropdown-toggle btn btn-icon btn-light" data-bs-toggle="dropdown"><em class="icon ni ni-more-v"></em></a>
|
||||
<div class="dropdown-menu dropdown-menu-datatable-custom dropdown-menu-end">
|
||||
<ul class="link-list-opt">
|
||||
<li><a href="'.$showUrl.'"><em class="icon ni ni-eye"></em><span>Detail</span></a></li>';
|
||||
<ul class="link-list-opt">';
|
||||
|
||||
if (is_role([1])) {
|
||||
if (is_role([1]) && $category !== 'system') {
|
||||
$dropdown .= '<li><a href="'.$showUrl.'"><em class="icon ni ni-eye"></em><span>Detail</span></a></li>';
|
||||
}else{
|
||||
$dropdown .= '<li><a href="'.$showUrl.'"><em class="icon ni ni-eye"></em><span>Baca</span></a></li>';
|
||||
}
|
||||
|
||||
if (is_role([1]) && $category !== 'system') {
|
||||
$dropdown .= '<li><a href="'.$editUrl.'"><em class="icon ni ni-edit"></em><span>Ubah</span></a></li>';
|
||||
}
|
||||
|
||||
if (is_role([1])) {
|
||||
if (is_role([1]) && $category !== 'system') {
|
||||
$dropdown .= '<li><a href="javascript:void(0);" onclick="deleteItem(\''.$deleteUrl.'\', \'Apakah Anda yakin ingin menghapus pengumuman '.$data->headline.'? Item ini akan dihapus secara permanen!\')"><em class="icon ni ni-trash"></em><span>Hapus</span></a></li>';
|
||||
|
||||
}
|
||||
@ -443,7 +462,7 @@ public function announcement(Request $request){
|
||||
return $dropdown;
|
||||
})
|
||||
|
||||
->rawColumns(['action'])
|
||||
->rawColumns(['headline', 'sender', 'action'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
@ -451,18 +470,27 @@ public function announcement(Request $request){
|
||||
|
||||
}
|
||||
|
||||
public function mediaAnnouncement(Request $request){
|
||||
public function mediaAnnouncement(Request $request, $category){
|
||||
if ($request->ajax()) {
|
||||
$data = Media::with(['announcements'])->findOrFail(Auth::user()->company->media->id)->announcements;
|
||||
$data = User::with(['announcements' => function($query) use ($category) {
|
||||
$query->wherePivot('category', $category)
|
||||
->where('enhancer_id', '!=', Auth::id());
|
||||
}])
|
||||
->findOrFail(Auth::user()->id)
|
||||
->announcements;
|
||||
|
||||
|
||||
return DataTables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('sent_at', function ($data) {
|
||||
return idn_date($data->created_at, 'l, d F Y');
|
||||
return idn_date($data->created_at, 'l, d F Y H:i');
|
||||
})
|
||||
->addColumn('sender', function ($data) {
|
||||
return $data->enhancer->name. ' (admin)';
|
||||
->addColumn('sender', function ($data) use ($category) {
|
||||
if ($category === 'system') {
|
||||
return '<span class="badge bg-warning" style="display:inline-block;font-size:0.8rem;">Sistem</span>';
|
||||
}else{
|
||||
return '<span class="badge bg-primary" style="display:inline-block;font-size:0.8rem;">Admin</span>';
|
||||
}
|
||||
})
|
||||
->addColumn('status', function ($data) {
|
||||
if ($data->pivot->status == '0') {
|
||||
@ -482,7 +510,7 @@ public function mediaAnnouncement(Request $request){
|
||||
<a class="dropdown-toggle btn btn-icon btn-light" data-bs-toggle="dropdown"><em class="icon ni ni-more-v"></em></a>
|
||||
<div class="dropdown-menu dropdown-menu-datatable-custom dropdown-menu-end">
|
||||
<ul class="link-list-opt">
|
||||
<li><a href="'.$showUrl.'"><em class="icon ni ni-eye"></em><span>Detail</span></a></li>';
|
||||
<li><a href="'.$showUrl.'"><em class="icon ni ni-eye"></em><span>Baca</span></a></li>';
|
||||
|
||||
if (is_role([1])) {
|
||||
$dropdown .= '<li><a href="'.$editUrl.'"><em class="icon ni ni-edit"></em><span>Ubah</span></a></li>';
|
||||
@ -500,7 +528,7 @@ public function mediaAnnouncement(Request $request){
|
||||
return $dropdown;
|
||||
})
|
||||
|
||||
->rawColumns(['sender', 'status', 'action'])
|
||||
->rawColumns(['headline', 'sender', 'status', 'action'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\CooperationRequest;
|
||||
use App\Models\Announcement;
|
||||
use App\Models\Cooperation;
|
||||
use App\Models\CooperationProposal;
|
||||
use App\Models\Media;
|
||||
@ -36,6 +37,26 @@ public function store(CooperationRequest $request){
|
||||
$createdCooperation = Cooperation::create($validatedData);
|
||||
$createdCooperation->media()->attach($validatedData['media_ids']);
|
||||
|
||||
// Announcements
|
||||
$userId = [];
|
||||
foreach($validatedData['media_ids'] as $mediaId){
|
||||
$userId[] = Media::find($mediaId)->company->user->id;
|
||||
}
|
||||
|
||||
$announcementData = [
|
||||
'headline' => 'Ajuan kerjasama baru: <u>'. $createdCooperation->name. '</u>',
|
||||
'content' => '<p>Kerjasama: <b>'. $validatedData['name']. '</b> </p>
|
||||
<p>Periode Pengajuan: <b>'.idn_date($createdCooperation->start_date).'</b> s.d. <b>'.idn_date($createdCooperation->end_date).'</b></p>
|
||||
<p>Deskripsi: <br>
|
||||
'.$createdCooperation->description.'
|
||||
</p>
|
||||
',
|
||||
'enhancer_id' => Auth::id()
|
||||
];
|
||||
$createdAnnouncement = Announcement::create($announcementData);
|
||||
$createdAnnouncement->users()->attach($userId, ['category' => 'system']);
|
||||
// End Announcements
|
||||
|
||||
if ($createdCooperation->media()->count() > 0) {
|
||||
return redirect()->route('dashboard.cooperations.index')->with('success-status', 'Berhasil menambahkan kerjasama.');
|
||||
} else {
|
||||
@ -56,6 +77,7 @@ public function edit($id){
|
||||
public function update(CooperationRequest $request, $id){
|
||||
$validatedData = $request->validated();
|
||||
$cooperation = Cooperation::with(['media'])->findOrFail(decrypt_id($id));
|
||||
$oldCooperationName = $cooperation->name;
|
||||
|
||||
$validatedData['enhancer_id'] = Auth::id();
|
||||
|
||||
@ -78,6 +100,23 @@ public function update(CooperationRequest $request, $id){
|
||||
$cooperation->media()->sync($validatedData['media_ids']);
|
||||
}
|
||||
|
||||
// Announcements
|
||||
$userId = [];
|
||||
foreach($validatedData['media_ids'] as $mediaId){
|
||||
$userId[] = Media::find($mediaId)->company->user->id;
|
||||
}
|
||||
|
||||
$announcementData = [
|
||||
'headline' => 'Admin melakukan pembaruan pada ajuan kerjasama <u>'. $oldCooperationName. '</u>',
|
||||
'content' => '<p>Admin telah melakukan pembaruan pada kerjasama <u>' . $oldCooperationName . '</u>.
|
||||
Mohon untuk segera meninjau perubahan tersebut</p>
|
||||
',
|
||||
'enhancer_id' => Auth::id()
|
||||
];
|
||||
$createdAnnouncement = Announcement::create($announcementData);
|
||||
$createdAnnouncement->users()->attach($userId, ['category' => 'system']);
|
||||
// End Announcements
|
||||
|
||||
if ($cooperation->media()->count() > 0) {
|
||||
return redirect()->back()->with('success-status', 'Berhasil mengubah kerjasama.');
|
||||
} else {
|
||||
@ -121,6 +160,17 @@ public function mediaProposalAccept($id, $proposalId){
|
||||
'status' => '1'
|
||||
]);
|
||||
|
||||
// Announcements
|
||||
$announcementData = [
|
||||
'headline' => 'Formulir ajuan kerjasama <u>'. $proposal->cooperation->name .'</u> telah <span class="text-primary">disetujui</span>',
|
||||
'content' => '<p>Admin telah menyetujui formulir pengajuan kerjasama Anda.</p>
|
||||
<p>Sekarang, kerjasama ini sudah tersedia di menu <b>Kerjasama</b>. Harap tunggu hingga Admin menerbitkan <b>Media Order</b>.</p>',
|
||||
'enhancer_id' => Auth::id()
|
||||
];
|
||||
$createdAnnouncement = Announcement::create($announcementData);
|
||||
$createdAnnouncement->users()->attach($proposal->media->company->user->id, ['category' => 'system']);
|
||||
// End Announcements
|
||||
|
||||
if ($acceptedProposal) {
|
||||
return redirect()->back()->with('success-status', 'Berhasil menyetujui pengajuan kerjasama.');
|
||||
} else {
|
||||
@ -153,6 +203,19 @@ public function mediaProposalRejectAction(Request $request, $id, $proposalId){
|
||||
'rejection_reason' => $validatedData['rejection_reason']
|
||||
]);
|
||||
|
||||
// Announcements
|
||||
$announcementData = [
|
||||
'headline' => 'Formulir ajuan kerjasama <u>'. $proposal->cooperation->name .'</u> <span class="text-danger">ditolak</span>',
|
||||
'content' => '<p>Admin telah menolak formulir pengajuan kerjasama Anda.
|
||||
<p>Alasan penolakan:<br> '.$validatedData['rejection_reason'].' </p>
|
||||
</p>
|
||||
',
|
||||
'enhancer_id' => Auth::id()
|
||||
];
|
||||
$createdAnnouncement = Announcement::create($announcementData);
|
||||
$createdAnnouncement->users()->attach($proposal->media->company->user->id, ['category' => 'system']);
|
||||
// End Announcements
|
||||
|
||||
if ($rejectedProposal) {
|
||||
return redirect()->back()->with('success-status', 'Berhasil menolak pengajuan kerjasama.');
|
||||
} else {
|
||||
@ -177,9 +240,12 @@ public function process($id, $process, $paramMediaId = null){
|
||||
});
|
||||
|
||||
if(filled($reports)){
|
||||
$data['isAllReportsAccepted'] = $reports->every(function ($item) {
|
||||
|
||||
$isAllReportsAccepted = $reports->every(function ($item) {
|
||||
return $item->status === '1';
|
||||
});
|
||||
|
||||
$data['isAllReportsAccepted'] = $isAllReportsAccepted && ($reports->count() === $data['mediaOrder']->required_reports);
|
||||
$data['isHaveReports'] = true;
|
||||
}else{
|
||||
$data['isAllReportsAccepted'] = false;
|
||||
@ -197,6 +263,27 @@ public function process($id, $process, $paramMediaId = null){
|
||||
if($mediaOrderSafe){
|
||||
$data['mediaOrderPivot'] = $mediaOrderSafe->pivot;
|
||||
}
|
||||
|
||||
// Can Commented
|
||||
if($mediaOrderSafe){
|
||||
$reports = $data['mediaOrder']->reports->filter(function ($reports) use ($data) {
|
||||
return $reports->media_id == Auth::user()->company->media->id;
|
||||
});
|
||||
}else{
|
||||
$reports = null;
|
||||
}
|
||||
|
||||
if(filled($reports)){
|
||||
$data['isAllReportsAccepted'] = $reports->every(function ($item) {
|
||||
return $item->status === '1';
|
||||
});
|
||||
$data['isHaveReports'] = true;
|
||||
}else{
|
||||
$data['isAllReportsAccepted'] = false;
|
||||
$data['isHaveReports'] = false;
|
||||
}
|
||||
// Can Commented
|
||||
|
||||
}
|
||||
|
||||
return view('dashboard.media-cooperations.processes.cooperations.index', $data);
|
||||
@ -207,6 +294,23 @@ public function process($id, $process, $paramMediaId = null){
|
||||
|
||||
if(is_role(['3'])){
|
||||
$data['mediaOrderPivot'] = $data['mediaOrder']->media->where('id', $data['mediaId'])->first()->pivot;
|
||||
|
||||
// Can Commented
|
||||
$reports = $data['mediaOrder']->reports->filter(function ($reports) use ($data) {
|
||||
return $reports->media_id == Auth::user()->company->media->id;
|
||||
});
|
||||
|
||||
if(filled($reports)){
|
||||
$data['isAllReportsAccepted'] = $reports->every(function ($item) {
|
||||
return $item->status === '1';
|
||||
});
|
||||
$data['isHaveReports'] = true;
|
||||
}else{
|
||||
$data['isAllReportsAccepted'] = false;
|
||||
$data['isHaveReports'] = false;
|
||||
}
|
||||
// Can Commented
|
||||
|
||||
}
|
||||
|
||||
return view('dashboard.media-cooperations.processes.media-orders.index', $data);
|
||||
@ -220,6 +324,22 @@ public function process($id, $process, $paramMediaId = null){
|
||||
|
||||
$data['reporterMediaId'] = Auth::user()->company->media->id;
|
||||
|
||||
// Can Commented
|
||||
// $reports = $data['mediaOrder']->reports->filter(function ($reports) use ($data) {
|
||||
// return $reports->media_id == Auth::user()->company->media->id;
|
||||
// });
|
||||
|
||||
// if(filled($reports)){
|
||||
// $data['isAllReportsAccepted'] = $reports->every(function ($item) {
|
||||
// return $item->status === '1';
|
||||
// });
|
||||
// $data['isHaveReports'] = true;
|
||||
// }else{
|
||||
// $data['isAllReportsAccepted'] = false;
|
||||
// $data['isHaveReports'] = false;
|
||||
// }
|
||||
// Can Commented
|
||||
|
||||
$reportCount = $reports->count();
|
||||
$data['reportCount'] = $reportCount;
|
||||
|
||||
@ -255,6 +375,23 @@ public function process($id, $process, $paramMediaId = null){
|
||||
|
||||
if(is_role(['3'])){
|
||||
$data['mediaOrderPivot'] = $data['mediaOrder']->media->where('id', $data['mediaId'])->first()->pivot;
|
||||
|
||||
// Can Commented
|
||||
// $reports = $data['mediaOrder']->reports->filter(function ($reports) use ($data) {
|
||||
// return $reports->media_id == Auth::user()->company->media->id;
|
||||
// });
|
||||
|
||||
// if(filled($reports)){
|
||||
// $data['isAllReportsAccepted'] = $reports->every(function ($item) {
|
||||
// return $item->status === '1';
|
||||
// });
|
||||
// $data['isHaveReports'] = true;
|
||||
// }else{
|
||||
// $data['isAllReportsAccepted'] = false;
|
||||
// $data['isHaveReports'] = false;
|
||||
// }
|
||||
// Can Commented
|
||||
|
||||
return view('dashboard.media-cooperations.processes.completions.index-media', $data);
|
||||
}else{
|
||||
abort(404);
|
||||
|
||||
@ -4,9 +4,11 @@
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\OrderRequest;
|
||||
use App\Models\Announcement;
|
||||
use App\Models\Cooperation;
|
||||
use App\Models\Media;
|
||||
use App\Models\Order;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
@ -35,6 +37,21 @@ public function store(OrderRequest $request, $id){
|
||||
$createdOrder = Order::create($validatedData);
|
||||
$createdOrder->media()->attach($validatedData['media_ids']);
|
||||
|
||||
// Announcements
|
||||
$userId = [];
|
||||
foreach($validatedData['media_ids'] as $mediaId){
|
||||
$userId[] = Media::find($mediaId)->company->user->id;
|
||||
}
|
||||
|
||||
$announcementData = [
|
||||
'headline' => '<p>Admin telah menerbitkan media order kerjasama <u>'. $cooperation->name .'</u></p>',
|
||||
'content' => '<p>Admin telah menerbitkan media order kerjasama '.$cooperation->name.'</p>',
|
||||
'enhancer_id' => Auth::id()
|
||||
];
|
||||
$createdAnnouncement = Announcement::create($announcementData);
|
||||
$createdAnnouncement->users()->attach($userId, ['category' => 'system']);
|
||||
// End Announcements
|
||||
|
||||
if ($createdOrder->media()->count() > 0) {
|
||||
return redirect()->route('dashboard.cooperations.process', ['id' => encrypt_id($cooperation->id), 'process' => 'media-order'])->with('success-status', 'Berhasil membuat media order.');
|
||||
} else {
|
||||
@ -109,6 +126,21 @@ public function accept(Request $request, $id){
|
||||
'status' => '1',
|
||||
]);
|
||||
|
||||
// Announcements
|
||||
$announcementData = [
|
||||
'headline' => 'Media <u>'.$mediaOrder->name.'</u> telah <span class="text-primary">menerima</span> media order kerjasama <b>'.$order->cooperation->name. '</b>',
|
||||
'content' => 'Media <u>'.$mediaOrder->name.'</u> telah <span class="text-primary">menerima</span> media order kerjasama <u>'.$order->cooperation->name.'</u>',
|
||||
'enhancer_id' => Auth::id()
|
||||
];
|
||||
|
||||
$adminIds = User::where('role_id', 1)->pluck('id')->mapWithKeys(function ($id) {
|
||||
return [$id => ['category' => 'system']];
|
||||
})->toArray();
|
||||
|
||||
$createdAnnouncement = Announcement::create($announcementData);
|
||||
$createdAnnouncement->users()->attach($adminIds);
|
||||
// End Announcements
|
||||
|
||||
if ($affectedRows > 0) {
|
||||
return redirect()->back()->with('success-status', 'Berhasil menerima media order.');
|
||||
} else {
|
||||
@ -142,6 +174,23 @@ public function reject(Request $request, $id){
|
||||
'rejection_reason' => $validatedData['rejection_reason']
|
||||
]);
|
||||
|
||||
// Announcements
|
||||
$announcementData = [
|
||||
'headline' => 'Media <u>'.$mediaOrder->name.'</u> <span class="text-danger">menolak</span> media order kerjasama <u>'.$order->cooperation->name. '</u>',
|
||||
'content' => 'Media <u>'.$mediaOrder->name.'</u> <span class="text-danger">menolak</span> media order kerjasama <u>'.$order->cooperation->name.'</u>
|
||||
<p>Alasan: <br> '.$validatedData['rejection_reason'].'</p>
|
||||
',
|
||||
'enhancer_id' => Auth::id()
|
||||
];
|
||||
|
||||
$adminIds = User::where('role_id', 1)->pluck('id')->mapWithKeys(function ($id) {
|
||||
return [$id => ['category' => 'system']];
|
||||
})->toArray();
|
||||
|
||||
$createdAnnouncement = Announcement::create($announcementData);
|
||||
$createdAnnouncement->users()->attach($adminIds);
|
||||
// End Announcements
|
||||
|
||||
if ($affectedRows > 0) {
|
||||
return redirect()->back()->with('success-status', 'Berhasil menolak media order.');
|
||||
} else {
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\ReportRequest;
|
||||
use App\Models\Announcement;
|
||||
use App\Models\Report;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@ -85,6 +86,16 @@ public function accept($id){
|
||||
'status' => '1'
|
||||
]);
|
||||
|
||||
// Announcements
|
||||
$announcementData = [
|
||||
'headline' => 'Laporan bukti tayang kerjasama <u>'. $report->order->cooperation->name .'</u> telah <span class="text-primary">disetujui</span>',
|
||||
'content' => '<p>Admin telah menyetujui laporan bukti tayang Anda.</p>',
|
||||
'enhancer_id' => Auth::id()
|
||||
];
|
||||
$createdAnnouncement = Announcement::create($announcementData);
|
||||
$createdAnnouncement->users()->attach($report->media->company->user->id, ['category' => 'system']);
|
||||
// End Announcements
|
||||
|
||||
if ($acceptedReport) {
|
||||
return redirect()->back()->with('success-status', 'Berhasil menyetujui laporan bukti tayang.');
|
||||
} else {
|
||||
@ -116,6 +127,16 @@ public function rejectAction(Request $request, $mediaOrderId, $id){
|
||||
'rejection_reason' => $validatedData['rejection_reason']
|
||||
]);
|
||||
|
||||
// Announcements
|
||||
$announcementData = [
|
||||
'headline' => 'Laporan bukti tayang kerjasama <u>'. $report->order->cooperation->name .'</u> telah <span class="text-danger">ditolak</span>',
|
||||
'content' => '<p>Admin telah menolak laporan bukti tayang Anda.</p>',
|
||||
'enhancer_id' => Auth::id()
|
||||
];
|
||||
$createdAnnouncement = Announcement::create($announcementData);
|
||||
$createdAnnouncement->users()->attach($report->media->company->user->id, ['category' => 'system']);
|
||||
// End Announcements
|
||||
|
||||
if ($rejectedReport) {
|
||||
return redirect()->back()->with('success-status', 'Berhasil menolak laporan bukti tayang.');
|
||||
} else {
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
use App\Models\Announcement;
|
||||
use App\Models\Media;
|
||||
use App\Models\User;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@ -20,11 +21,11 @@ class AnnouncementMiddleware
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if(Auth::check() && Auth::user()->role_id == 3){
|
||||
$media = Media::with(['announcements' => function($query) {
|
||||
$user = User::with(['announcements' => function($query) {
|
||||
$query->orderBy('id', 'desc');
|
||||
}])->find(Auth::user()->company->media->id);
|
||||
}])->find(Auth::user()->id);
|
||||
|
||||
View::share('announcements', $media->announcements);
|
||||
View::share('announcements', $user->announcements);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
||||
@ -24,9 +24,11 @@ public function rules(): array
|
||||
{
|
||||
return [
|
||||
'headline' => ['required'],
|
||||
'media_ids' => ['required', 'array'],
|
||||
'media_ids.*' => ['required', 'exists:media,id'],
|
||||
'user_ids' => ['required', 'array'],
|
||||
'user_ids.*' => ['required', 'exists:users,id'],
|
||||
'content' => ['required'],
|
||||
'link' => ['nullable', 'url'],
|
||||
'attachment' => ['nullable', 'file', 'mimes:pdf', 'max:2048'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -34,10 +36,10 @@ public function messages(): array
|
||||
{
|
||||
return [
|
||||
'headline.required' => 'Judul pengumuman harus diisi.',
|
||||
'media_ids.required' => 'Pilih setidaknya satu media untuk pengumuman.',
|
||||
'media_ids.array' => 'Media harus dalam format array.',
|
||||
'media_ids.*.required' => 'Media yang dipilih tidak boleh kosong.',
|
||||
'media_ids.*.exists' => 'Salah satu media yang dipilih tidak ditemukan.',
|
||||
'user_ids.required' => 'Pilih setidaknya satu media untuk pengumuman.',
|
||||
'user_ids.array' => 'Media harus dalam format array.',
|
||||
'user_ids.*.required' => 'Media yang dipilih tidak boleh kosong.',
|
||||
'user_ids.*.exists' => 'Salah satu media yang dipilih tidak ditemukan.',
|
||||
'content.required' => 'Konten pengumuman harus diisi.',
|
||||
];
|
||||
}
|
||||
|
||||
@ -22,16 +22,23 @@ public function authorize(): bool
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
$rules = [
|
||||
'name' => ['required'],
|
||||
'start_date' => ['required', 'date'],
|
||||
'end_date' => ['required', 'date'],
|
||||
'media_ids' => ['required', 'array'],
|
||||
'media_ids.*' => ['required', 'exists:media,id'],
|
||||
'banner' => ['nullable', 'image', 'mimes:png,jpg,jpeg', 'max:2048'],
|
||||
'offer_file_template' => ['required', 'file','mimes:pdf' , 'max:2048'],
|
||||
'description' => ['required'],
|
||||
];
|
||||
|
||||
if($this->isMethod('post')){
|
||||
$rules['offer_file_template'] = ['required', 'file','mimes:pdf', 'max:2048'];
|
||||
}else{
|
||||
$rules['offer_file_template'] = ['nullable', 'file','mimes:pdf', 'max:2048'];
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
|
||||
@ -11,6 +11,8 @@ class Announcement extends Model
|
||||
protected $fillable = [
|
||||
'headline',
|
||||
'content',
|
||||
'link',
|
||||
'attachment',
|
||||
'enhancer_id'
|
||||
];
|
||||
|
||||
@ -18,10 +20,10 @@ public function enhancer(){
|
||||
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
||||
}
|
||||
|
||||
public function media()
|
||||
public function users()
|
||||
{
|
||||
return $this->belongsToMany(Media::class, 'announcements_media', 'announcement_id', 'media_id')
|
||||
->using(AnnouncementMedia::class)
|
||||
return $this->belongsToMany(User::class, 'announcements_users', 'announcement_id', 'user_id')
|
||||
->using(AnnouncementUser::class)
|
||||
->withPivot(['status', 'category'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
@ -5,13 +5,13 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
|
||||
class AnnouncementMedia extends Pivot
|
||||
class AnnouncementUser extends Pivot
|
||||
{
|
||||
protected $table = 'announcements_media';
|
||||
protected $table = 'announcements_users';
|
||||
|
||||
protected $fillable = [
|
||||
'announcement_id',
|
||||
'media_id',
|
||||
'user_id',
|
||||
'status',
|
||||
'category'
|
||||
];
|
||||
@ -20,7 +20,7 @@ public function announcement(){
|
||||
return $this->belongsTo(Announcement::class, 'announcement_id', 'id');
|
||||
}
|
||||
|
||||
public function media(){
|
||||
return $this->belongsTo(Media::class, 'media_id', 'id');
|
||||
public function user(){
|
||||
return $this->belongsTo(User::class, 'user_id', 'id');
|
||||
}
|
||||
}
|
||||
@ -34,14 +34,6 @@ public function journalists(){
|
||||
return $this->hasMany(Journalist::class, 'media_id', 'id');
|
||||
}
|
||||
|
||||
public function announcements()
|
||||
{
|
||||
return $this->belongsToMany(Announcement::class, 'announcements_media', 'media_id', 'announcement_id')
|
||||
->using(AnnouncementMedia::class)
|
||||
->withPivot(['status', 'category'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function cooperations()
|
||||
{
|
||||
return $this->belongsToMany(Cooperation::class, 'media_cooperations', 'media_id', 'cooperation_id')
|
||||
|
||||
@ -51,6 +51,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function announcements()
|
||||
{
|
||||
return $this->belongsToMany(Announcement::class, 'announcements_users', 'user_id', 'announcement_id')
|
||||
->using(AnnouncementUser::class)
|
||||
->withPivot(['status', 'category'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function role(){
|
||||
return $this->belongsTo(Role::class, 'role_id', 'id');
|
||||
}
|
||||
|
||||
@ -13,8 +13,10 @@ public function up(): void
|
||||
{
|
||||
Schema::create('announcements', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('headline');
|
||||
$table->text('headline');
|
||||
$table->text('content');
|
||||
$table->text('link')->nullable();
|
||||
$table->string('attachment')->nullable();
|
||||
$table->unsignedBigInteger('enhancer_id');
|
||||
$table->foreign('enhancer_id')->references('id')->on('users');
|
||||
$table->timestamps();
|
||||
|
||||
@ -11,14 +11,14 @@
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('announcements_media', function (Blueprint $table) {
|
||||
Schema::create('announcements_users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('announcement_id');
|
||||
$table->unsignedBigInteger('media_id');
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->foreign('announcement_id')->references('id')->on('announcements');
|
||||
$table->foreign('media_id')->references('id')->on('media');
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
$table->enum('status', ['0', '1'])->default('0');
|
||||
$table->enum('category', ['general', 'cooperation','non_general'])->default('general');
|
||||
$table->enum('category', ['general', 'system'])->default('general');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
@ -28,6 +28,6 @@ public function up(): void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('announcements_media');
|
||||
Schema::dropIfExists('announcements_users');
|
||||
}
|
||||
};
|
||||
@ -12,10 +12,10 @@
|
||||
<div class="card-head">
|
||||
<h5 class="card-title">{{$title}}</h5>
|
||||
</div>
|
||||
<form action="{{route('dashboard.announcements.store')}}" method="post">
|
||||
<form action="{{route('dashboard.announcements.store')}}" method="post" id="myForm" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="row g-4">
|
||||
<div class="col-lg-6">
|
||||
<div class="col-lg-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="headline">Headline<span class="required-input">*</span></label>
|
||||
<div class="form-control-wrap">
|
||||
@ -28,18 +28,18 @@
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Media<span class="required-input">*</span></label>
|
||||
<label class="form-label">Pengguna<span class="required-input">*</span></label>
|
||||
<div class="form-control-wrap">
|
||||
<select class="form-select js-select2" data-search="on" name="media_ids[]" multiple="multiple" data-placeholder="Pilih Media">
|
||||
@foreach ($media as $item)
|
||||
<select class="form-select js-select2" data-search="on" name="user_ids[]" multiple="multiple" data-placeholder="Pilih Pengguna">
|
||||
@foreach ($users as $item)
|
||||
<option value="{{ $item->id }}"
|
||||
{{ is_array(old('media_ids')) && in_array($item->id, old('media_ids')) ? 'selected' : '' }}>
|
||||
{{ $item->name }}
|
||||
{{ is_array(old('user_ids')) && in_array($item->id, old('user_ids')) ? 'selected' : '' }}>
|
||||
{{ $item->name }} {{ $item->role_id === 3 ? ($item->company ? '[Perusahaan: '.$item->company->name.']' : '') : '' }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@error('media_ids')
|
||||
@error('user_ids')
|
||||
<span class="validation-error">{{$message}}</span>
|
||||
@enderror
|
||||
</div>
|
||||
@ -52,11 +52,33 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="link">Link</label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="text" class="form-control @error('link') border-danger @enderror" id="link" name="link" placeholder="Masukan link" value="{{old('link')}}">
|
||||
</div>
|
||||
@error('link')
|
||||
<span class="validation-error">{{$message}}</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="attachment">Lampiran <span class="pdf-label">(PDF)</span></label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="file" class="form-control @error('attachment') border-danger @enderror" id="attachment" name="attachment" placeholder="Masukan attachment" value="{{old('attachment')}}">
|
||||
</div>
|
||||
@error('attachment')
|
||||
<span class="validation-error">{{$message}}</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<hr>
|
||||
<div class="form-group d-flex justify-content-end">
|
||||
<a href="{{route('dashboard.announcements.index')}}" class="btn btn-white btn-dim btn-outline-light mx-2"><span>Kembali</span></a>
|
||||
<button type="submit" class="btn btn-md btn-primary">Tambahkan</button>
|
||||
<button type="button" class="btn btn-md btn-primary" id="submitButton">Tambahkan</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -12,11 +12,11 @@
|
||||
<div class="card-head">
|
||||
<h5 class="card-title">{{$title}}</h5>
|
||||
</div>
|
||||
<form action="{{route('dashboard.announcements.update', ['id' => encrypt_id($announcement->id)])}}" method="post">
|
||||
<form action="{{route('dashboard.announcements.update', ['id' => encrypt_id($announcement->id)])}}" method="post" id="myForm" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('put')
|
||||
<div class="row g-4">
|
||||
<div class="col-lg-6">
|
||||
<div class="col-lg-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="headline">Headline<span class="required-input">*</span></label>
|
||||
<div class="form-control-wrap">
|
||||
@ -29,18 +29,18 @@
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Media<span class="required-input">*</span></label>
|
||||
<label class="form-label">Pengguna<span class="required-input">*</span></label>
|
||||
<div class="form-control-wrap">
|
||||
<select class="form-select js-select2" data-search="on" name="media_ids[]" multiple="multiple" data-placeholder="Pilih Media">
|
||||
@foreach ($media as $item)
|
||||
<select class="form-select js-select2" data-search="on" name="user_ids[]" multiple="multiple" data-placeholder="Pilih Pengguna">
|
||||
@foreach ($users as $item)
|
||||
<option value="{{ $item->id }}"
|
||||
{{ in_array($item->id, old('media_ids', $selectedMediaIds)) ? 'selected' : '' }}>
|
||||
{{ in_array($item->id, old('user_ids', $selectedUsersIds)) ? 'selected' : '' }}>
|
||||
{{ $item->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@error('media_ids')
|
||||
@error('user_ids')
|
||||
<span class="validation-error">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
@ -53,11 +53,33 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="link">Link</label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="text" class="form-control @error('link') border-danger @enderror" id="link" name="link" placeholder="Masukan link" value="{{$announcement->link}}">
|
||||
</div>
|
||||
@error('link')
|
||||
<span class="validation-error">{{$message}}</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="attachment">Lampiran <span class="pdf-label">(PDF)</span></label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="file" class="form-control @error('attachment') border-danger @enderror" id="attachment" name="attachment" placeholder="Masukan attachment">
|
||||
</div>
|
||||
@error('attachment')
|
||||
<span class="validation-error">{{$message}}</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<hr>
|
||||
<div class="form-group d-flex justify-content-end">
|
||||
<a href="{{route('dashboard.announcements.index')}}" class="btn btn-white btn-dim btn-outline-light mx-2"><span>Kembali</span></a>
|
||||
<button type="submit" class="btn btn-md btn-primary">Simpan</button>
|
||||
<button type="button" class="btn btn-md btn-primary" id="submitButton">Simpan</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -40,20 +40,33 @@
|
||||
<div class="nk-block nk-block-lg">
|
||||
<div class="card card-bordered card-preview">
|
||||
<div class="card-inner">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered nowrap" id="announcementsTable" border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 10% !important;">No</th>
|
||||
<th>Headline</th>
|
||||
<th>Tanggal Kirim</th>
|
||||
<th style="width: 10% !important;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<ul class="nav nav-tabs mt-n3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{$category == 'general' ? 'active' : ''}}" href="{{route('dashboard.announcements.index', ['category' => 'general'])}}"><em class="icon ni ni-globe"></em><span>Umum</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{$category == 'system' ? 'active' : ''}}" href="{{route('dashboard.announcements.index', ['category' => 'system'])}}"><em class="icon ni ni-share-alt"></em><span>Sistem</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabItem5">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered nowrap" id="announcementsTable" border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Headline</th>
|
||||
<th>Pengirim</th>
|
||||
<th>Tanggal</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- .card-preview -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -40,22 +40,34 @@
|
||||
<div class="nk-block nk-block-lg">
|
||||
<div class="card card-bordered card-preview">
|
||||
<div class="card-inner">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered nowrap" id="mediaAnnouncementsTable" border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 10% !important;">No</th>
|
||||
<th>Headline</th>
|
||||
<th>Tanggal</th>
|
||||
<th>Pengirim</th>
|
||||
<th>Status</th>
|
||||
<th style="width: 10% !important;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<ul class="nav nav-tabs mt-n3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{$category == 'general' ? 'active' : ''}}" href="{{route('dashboard.announcements.index', ['category' => 'general'])}}"><em class="icon ni ni-globe"></em><span>Umum</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{$category == 'system' ? 'active' : ''}}" href="{{route('dashboard.announcements.index', ['category' => 'system'])}}"><em class="icon ni ni-share-alt"></em><span>Sistem</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabItem5">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered nowrap" id="mediaAnnouncementsTable" border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 10% !important;">No</th>
|
||||
<th>Headline</th>
|
||||
<th>Pengirim</th>
|
||||
<th>Tanggal</th>
|
||||
<th>Status</th>
|
||||
<th style="width: 10% !important;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- .card-preview -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
<div class="profile-ud-item">
|
||||
<div class="profile-ud wider">
|
||||
<span class="profile-ud-label">Headline</span>
|
||||
<span class="profile-ud-value">{{$announcement->headline}}</span>
|
||||
<span class="profile-ud-value">{!!$announcement->headline!!}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="profile-ud-item">
|
||||
@ -34,6 +34,18 @@
|
||||
<span class="profile-ud-value">{{idn_date($announcement->created_at, 'l, d F Y')}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="profile-ud-item">
|
||||
<div class="profile-ud wider">
|
||||
<span class="profile-ud-label">Link</span>
|
||||
<span class="profile-ud-value">
|
||||
@if (filled($announcement->link))
|
||||
<a href="{{$announcement->link}}" target="__blank">{{$announcement->link}}</a>
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- .profile-ud-list -->
|
||||
</div><!-- .nk-block -->
|
||||
{{-- <div class="nk-divider divider md"></div> --}}
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
<div class="profile-ud-item">
|
||||
<div class="profile-ud wider">
|
||||
<span class="profile-ud-label">Headline</span>
|
||||
<span class="profile-ud-value">{{$announcement->headline}}</span>
|
||||
<span class="profile-ud-value">{!!$announcement->headline!!}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="profile-ud-item">
|
||||
@ -34,23 +34,37 @@
|
||||
<span class="profile-ud-value">{{idn_date($announcement->created_at, 'l, d F Y')}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="profile-ud-item">
|
||||
<div class="profile-ud wider">
|
||||
<span class="profile-ud-label">Link</span>
|
||||
<span class="profile-ud-value">
|
||||
@if (filled($announcement->link))
|
||||
<a href="{{$announcement->link}}" target="__blank">{{$announcement->link}}</a>
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- .profile-ud-list -->
|
||||
</div><!-- .nk-block -->
|
||||
{{-- <div class="nk-divider divider md"></div> --}}
|
||||
@if ($announcement->users[0]->pivot->category !== 'system')
|
||||
<div class="nk-block">
|
||||
<div class="nk-block-head nk-block-head-sm nk-block-between">
|
||||
<span class="profile-ud-label">Media</span>
|
||||
<span class="profile-ud-label">Pengguna</span>
|
||||
</div><!-- .nk-block-head -->
|
||||
<div class="bq-note">
|
||||
<div class="bq-note-item">
|
||||
<div class="bq-note-text">
|
||||
@foreach ($announcement->media as $media)
|
||||
<span class="profile-ud-value"><span class="badge bg-info">{{$media->name}}</span></span>
|
||||
@foreach ($announcement->users as $user)
|
||||
<span class="profile-ud-value"><span class="badge bg-info">{{$user->name}}</span></span>
|
||||
@endforeach
|
||||
</div>
|
||||
</div><!-- .bq-note-item -->
|
||||
</div><!-- .bq-note -->
|
||||
</div><!-- .nk-block -->
|
||||
@endif
|
||||
<div class="nk-block">
|
||||
<div class="nk-block-head nk-block-head-sm nk-block-between">
|
||||
<span class="profile-ud-label">Konten</span>
|
||||
@ -63,9 +77,39 @@
|
||||
</div><!-- .bq-note-item -->
|
||||
</div><!-- .bq-note -->
|
||||
</div><!-- .nk-block -->
|
||||
@if (filled($announcement->attachment))
|
||||
<div id="accordion" class="accordion my-3">
|
||||
<div class="accordion-item">
|
||||
<a href="#" class="accordion-head collapsed" data-bs-toggle="collapse" data-bs-target="#accordion-item-2">
|
||||
<h6 class="title">Lampiran</h6>
|
||||
<span class="accordion-icon"></span>
|
||||
</a>
|
||||
<div class="accordion-body collapse" id="accordion-item-2" data-bs-parent="#accordion">
|
||||
<div class="accordion-inner">
|
||||
<div class="bq-note">
|
||||
<div class="bq-note-item">
|
||||
<div class="bq-note-text">
|
||||
@if (filled($announcement->attachment))
|
||||
<iframe src="{{ asset('storage/uploads/announcements/' . $announcement->attachment) }}"
|
||||
width="100%" height="400">
|
||||
<p>Browser Anda tidak mendukung PDF viewer. Anda bisa mengunduh PDF ini <a href="{{ asset('storage/uploads/announcements/' . $announcement->attachment) }}">di sini</a>.</p>
|
||||
</iframe>
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</div>
|
||||
</div><!-- .bq-note-item -->
|
||||
</div><!-- .bq-note -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="nk-block d-flex justify-content-end">
|
||||
<a href="{{route('dashboard.announcements.index')}}" class="btn btn-white btn-dim btn-outline-light mx-2"><span>Kembali</span></a>
|
||||
<a href="{{route('dashboard.announcements.edit', ['id' => encrypt_id($announcement->id)])}}" class="btn btn-warning"><span>Ubah</span></a>
|
||||
@if ($announcement->users[0]->pivot->category !== 'system')
|
||||
<a href="{{route('dashboard.announcements.edit', ['id' => encrypt_id($announcement->id)])}}" class="btn btn-warning"><span>Ubah</span></a>
|
||||
@endif
|
||||
</div><!-- .nk-block -->
|
||||
</div><!-- .card-inner -->
|
||||
</div><!-- .card-content -->
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
<a class="nav-link" data-bs-toggle="tab" href="#proposalData">Data Pengajuan</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form action="{{route('dashboard.cooperations.requests.proposal.update', ['id' => encrypt_id($proposal->id)])}}" method="post" enctype="multipart/form-data">
|
||||
<form action="{{route('dashboard.cooperations.requests.proposal.update', ['id' => encrypt_id($proposal->id)])}}" method="post" enctype="multipart/form-data" id="myForm">
|
||||
@csrf
|
||||
@method('put')
|
||||
<div class="tab-content">
|
||||
@ -320,7 +320,7 @@
|
||||
<hr>
|
||||
<div class="nk-block d-flex justify-content-end">
|
||||
<a href="{{route('dashboard.cooperations.requests.media.proposals')}}" class="btn btn-white btn-dim btn-outline-light mx-2"><span>Kembali</span></a>
|
||||
<button type="submit" class="btn btn-md btn-primary">Simpan</button>
|
||||
<button type="button" class="btn btn-md btn-primary" id="submitButton">Simpan</button>
|
||||
</div><!-- .nk-block -->
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@ -120,7 +120,7 @@
|
||||
</ul><!-- .nav-tabs -->
|
||||
<div class="card-inner">
|
||||
{{-- {{dd($mediaCooperationPivot->status != '0')}} --}}
|
||||
<form action="{{route('dashboard.cooperations.requests.reject.action', ['id' => encrypt_id($cooperation->id)])}}" method="post">
|
||||
<form action="{{route('dashboard.cooperations.requests.reject.action', ['id' => encrypt_id($cooperation->id)])}}" method="post" id="myForm">
|
||||
@csrf
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="rejection_reason">Alasan Menolak @if($mediaCooperationPivot->status === '0')<span class="required-input">*</span> @endif </label>
|
||||
@ -142,7 +142,7 @@
|
||||
<div class="nk-block d-flex justify-content-end">
|
||||
<a href="{{route('dashboard.cooperations.requests.index')}}" class="btn btn-white btn-dim btn-outline-light mx-2"><span>Kembali</span></a>
|
||||
@if ($mediaCooperationPivot->status === '0')
|
||||
<button type="submit" class="btn btn-primary">Kirim</button>
|
||||
<button type="button" class="btn btn-primary" id="submitButton">Kirim</button>
|
||||
@endif
|
||||
</div><!-- .nk-block -->
|
||||
</form>
|
||||
|
||||
@ -332,7 +332,7 @@
|
||||
</ul><!-- .nav-tabs -->
|
||||
<div class="card-inner">
|
||||
{{-- {{dd($mediaCooperationPivot->status != '0')}} --}}
|
||||
<form action="{{route('dashboard.cooperations.media.proposal.reject.action', ['id' => encrypt_id($proposal->cooperation->id), 'proposal_id' => encrypt_id($proposal->id)])}}" method="post">
|
||||
<form action="{{route('dashboard.cooperations.media.proposal.reject.action', ['id' => encrypt_id($proposal->cooperation->id), 'proposal_id' => encrypt_id($proposal->id)])}}" method="post" id="myForm">
|
||||
@csrf
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="rejection_reason">Alasan Menolak @if ($proposal->status === '0')
|
||||
@ -355,7 +355,9 @@
|
||||
<hr>
|
||||
<div class="nk-block d-flex justify-content-end">
|
||||
<a href="{{route('dashboard.cooperations.media.proposal', ['id' => encrypt_id($proposal->cooperation->id)])}}" class="btn btn-white btn-dim btn-outline-light mx-2"><span>Kembali</span></a>
|
||||
<button type="submit" class="btn btn-primary">Kirim</button>
|
||||
@if ($proposal->status === '0')
|
||||
<button type="button" class="btn btn-primary" id="submitButton">Kirim</button>
|
||||
@endif
|
||||
</div><!-- .nk-block -->
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@ -190,18 +190,39 @@
|
||||
$('#announcementsTable').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: '{{ route('dashboard.announcements.data') }}',
|
||||
ajax: '{{ route('dashboard.announcements.data', ["type" => $category]) }}',
|
||||
columns: [
|
||||
{ data: 'DT_RowIndex', name: 'DT_RowIndex', orderable: false, searchable: false },
|
||||
{ data: 'headline', name: 'headline' },
|
||||
{ data: 'sender', name: 'sender' },
|
||||
{ data: 'sent_at', name: 'sent_at' },
|
||||
{ data: 'action', name: 'action', orderable: false, searchable: false },
|
||||
{ data: 'created_at', name: 'created_at', visible: false },
|
||||
{ data: 'id', name: 'id', orderable: true, searchable: false, visible: false },
|
||||
],
|
||||
columnDefs: [
|
||||
{ targets: 0, width: '10%' }, // Kolom No
|
||||
{
|
||||
targets: 1,
|
||||
width: '30%',
|
||||
createdCell: function(td, cellData, rowData, row, col) {
|
||||
// Membungkus teks di kolom Headline
|
||||
$(td).css({
|
||||
'word-wrap': 'break-word',
|
||||
'white-space': 'normal',
|
||||
'overflow-wrap': 'break-word'
|
||||
});
|
||||
}
|
||||
}, // Kolom Headline
|
||||
{ targets: 2, width: '10%' }, // Kolom Pengirim
|
||||
{ targets: 3, width: '18%' }, // Kolom Tanggal
|
||||
{ targets: 4, width: '5%' }, // Kolom aksi
|
||||
],
|
||||
language: datatableLanguage,
|
||||
autoWidth: false,
|
||||
order: [[5, 'desc']],
|
||||
order: [
|
||||
[5, 'desc']
|
||||
],
|
||||
pagingType: "simple",
|
||||
lengthMenu: [[10, 25, 50, 100, -1], ['Tampilkan 10 data', 'Tampilkan 25 data', 'Tampilkan 50 data', 'Tampilkan 100 data', 'Tampilkan semua']],
|
||||
scrollX: true
|
||||
@ -216,20 +237,42 @@
|
||||
$('#mediaAnnouncementsTable').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: '{{ route('dashboard.announcements.media.data') }}',
|
||||
ajax: '{{ route('dashboard.announcements.media.data', ["type" => $category]) }}',
|
||||
columns: [
|
||||
{ data: 'DT_RowIndex', name: 'DT_RowIndex', orderable: false, searchable: false },
|
||||
{ data: 'headline', name: 'headline' },
|
||||
{ data: 'sent_at', name: 'sent_at' },
|
||||
{ data: 'sender', name: 'sender' },
|
||||
{ data: 'sent_at', name: 'sent_at' },
|
||||
{ data: 'status', name: 'status' },
|
||||
{ data: 'action', name: 'action', orderable: false, searchable: false },
|
||||
{ data: 'created_at', name: 'created_at', visible: false },
|
||||
{ data: 'id', name: 'id', orderable: true, searchable: false, visible: false },
|
||||
],
|
||||
columnDefs: [
|
||||
{ targets: 0, width: '10%' }, // Kolom No
|
||||
{
|
||||
targets: 1,
|
||||
width: '30%',
|
||||
createdCell: function(td, cellData, rowData, row, col) {
|
||||
// Membungkus teks di kolom Headline
|
||||
$(td).css({
|
||||
'word-wrap': 'break-word',
|
||||
'white-space': 'normal',
|
||||
'overflow-wrap': 'break-word'
|
||||
});
|
||||
}
|
||||
}, // Kolom Headline
|
||||
{ targets: 2, width: '10%' }, // Kolom Pengirim
|
||||
{ targets: 3, width: '18%' }, // Kolom Tanggal
|
||||
{ targets: 4, width: '10%' }, // Kolom Status
|
||||
{ targets: 5, width: '5%' }, // Kolom aksi
|
||||
],
|
||||
language: datatableLanguage,
|
||||
autoWidth: false,
|
||||
order: [[6, 'desc']],
|
||||
order: [
|
||||
[4, 'desc'],
|
||||
[6, 'desc']
|
||||
],
|
||||
pagingType: "simple",
|
||||
lengthMenu: [[10, 25, 50, 100, -1], ['Tampilkan 10 data', 'Tampilkan 25 data', 'Tampilkan 50 data', 'Tampilkan 100 data', 'Tampilkan semua']],
|
||||
scrollX: true
|
||||
|
||||
@ -171,8 +171,8 @@
|
||||
Route::get('/{id}/read', 'read')->name('read');
|
||||
});
|
||||
|
||||
Route::get('/data', [DatatableController::class, 'announcement'])->name('data');
|
||||
Route::get('/announcement-media-data', [DatatableController::class, 'mediaAnnouncement'])->name('media.data');
|
||||
Route::get('/data/{type?}', [DatatableController::class, 'announcement'])->name('data');
|
||||
Route::get('/announcement-media-data/{type}', [DatatableController::class, 'mediaAnnouncement'])->name('media.data');
|
||||
});
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user