diff --git a/app/Http/Controllers/Dashboard/CompanyController.php b/app/Http/Controllers/Dashboard/CompanyController.php
index ba0bb9f..9e78cad 100644
--- a/app/Http/Controllers/Dashboard/CompanyController.php
+++ b/app/Http/Controllers/Dashboard/CompanyController.php
@@ -10,6 +10,7 @@
use App\Models\LoginHistory;
use App\Models\Role;
use App\Models\User;
+use Barryvdh\DomPDF\Facade\Pdf;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
@@ -303,4 +304,14 @@ public function filter(Request $request){
return redirect()->route('dashboard.companies.index', $filterField);
}
+
+ public function printData($id){
+
+ $company = Company::with(['user.role'])->findOrFail(decrypt_id($id));
+
+
+ $pdf = Pdf::loadView('dashboard.companies.print', compact('company'));
+
+ return $pdf->stream('perusahaan-'.slugify($company->name).'.pdf');
+ }
}
diff --git a/app/Http/Controllers/Dashboard/DatatableController.php b/app/Http/Controllers/Dashboard/DatatableController.php
index 4587ed3..8313bc3 100644
--- a/app/Http/Controllers/Dashboard/DatatableController.php
+++ b/app/Http/Controllers/Dashboard/DatatableController.php
@@ -789,6 +789,8 @@ public function company(Request $request){
->addColumn('action', function ($data) {
$showUrl = route('dashboard.companies.show', ['id' => encrypt_id($data->user->id), 'type' => 'company']);
+ $printUrl = route('dashboard.companies.data.print', ['id' => encrypt_id($data->id)]);
+
$deleteUrl = route('dashboard.companies.destroy', ['id' => encrypt_id($data->id)]);
$processAccountCompanyUrl = route('dashboard.companies.process', ['id' => encrypt_id($data->user->id), 'type' => 'company', 'category' => 'account-status']);
@@ -801,6 +803,10 @@ public function company(Request $request){
- Detail
';
+ if (is_role([1])) {
+ $dropdown .= '- Cetak
';
+ }
+
if (is_role([1]) && $data->user->status === '0') {
$dropdown .= '- Proses Perusahaan
';
}
diff --git a/app/Http/Requests/CompanyRequest.php b/app/Http/Requests/CompanyRequest.php
index 5647343..ca76020 100644
--- a/app/Http/Requests/CompanyRequest.php
+++ b/app/Http/Requests/CompanyRequest.php
@@ -28,21 +28,21 @@ public function rules(): array
'company_address' => ['required'],
'company_director_name' => ['required', 'max:100'],
'company_director_nik' => ['required', 'max:100'],
- 'company_director_nik_doc' => ['nullable', 'file', 'mimes:pdf', 'max:2048'],
+ 'company_director_nik_doc' => ['nullable', 'file', 'mimes:pdf,jpeg,png,jpg,gif', 'max:2048'],
'company_deed_incorporation' => ['nullable', 'max:100'],
- 'company_deed_incorporation_doc' => ['nullable', 'file', 'mimes:pdf', 'max:2048'],
+ 'company_deed_incorporation_doc' => ['nullable', 'file', 'mimes:pdf,jpeg,png,jpg,gif', 'max:2048'],
'company_trade_license' => ['nullable', 'max:100'],
- 'company_trade_license_doc' => ['nullable', 'file', 'mimes:pdf', 'max:2048'],
+ 'company_trade_license_doc' => ['nullable', 'file', 'mimes:pdf,jpeg,png,jpg,gif', 'max:2048'],
'company_tax_id_number' => ['nullable', 'max:100'],
- 'company_tax_id_number_doc' => ['nullable', 'file', 'mimes:pdf', 'max:2048'],
+ 'company_tax_id_number_doc' => ['nullable', 'file', 'mimes:pdf,jpeg,png,jpg,gif', 'max:2048'],
'company_taxable_enterprise' => ['nullable', 'max:100'],
- 'company_taxable_enterprise_doc' => ['nullable', 'file', 'mimes:pdf', 'max:2048'],
+ 'company_taxable_enterprise_doc' => ['nullable', 'file', 'mimes:pdf,jpeg,png,jpg,gif', 'max:2048'],
'company_annual_tax_return' => ['nullable', 'max:100'],
- 'company_annual_tax_return_doc' => ['nullable', 'file', 'mimes:pdf', 'max:2048'],
+ 'company_annual_tax_return_doc' => ['nullable', 'file', 'mimes:pdf,jpeg,png,jpg,gif', 'max:2048'],
'company_domicile_certificate' => ['nullable', 'max:100'],
- 'company_domicile_certificate_doc' => ['nullable', 'file', 'mimes:pdf', 'max:2048'],
+ 'company_domicile_certificate_doc' => ['nullable', 'file', 'mimes:pdf,jpeg,png,jpg,gif', 'max:2048'],
'company_profile' => ['nullable', 'max:100'],
- 'company_profile_doc' => ['nullable', 'file', 'mimes:pdf', 'max:2048'],
+ 'company_profile_doc' => ['nullable', 'file', 'mimes:pdf,jpeg,png,jpg,gif', 'max:2048'],
];
}
diff --git a/resources/views/dashboard/companies/edit.blade.php b/resources/views/dashboard/companies/edit.blade.php
index ee27603..a6d0497 100644
--- a/resources/views/dashboard/companies/edit.blade.php
+++ b/resources/views/dashboard/companies/edit.blade.php
@@ -138,7 +138,7 @@
@@ -160,7 +160,7 @@
@@ -182,7 +182,7 @@
@@ -204,7 +204,7 @@
@@ -226,7 +226,7 @@
@@ -248,7 +248,7 @@
@@ -270,7 +270,7 @@
@@ -292,7 +292,7 @@
diff --git a/resources/views/dashboard/companies/print.blade.php b/resources/views/dashboard/companies/print.blade.php
new file mode 100644
index 0000000..036b5f2
--- /dev/null
+++ b/resources/views/dashboard/companies/print.blade.php
@@ -0,0 +1,229 @@
+
+
+
+
+ Data Perusahaan - {{ $company->name }}
+
+
+
+
+
+
}})
+
+
+
+
+
+
+
+
Media
+
{{ $company->media->name }}
+
+
+
Direktur
+
{{ $company->director_name }}
+
+
+
NIK Direktur
+
{{ $company->director_nik }}
+
+
+
Alamat
+
{{ $company->address }}
+
+
+
Email
+
{{ $company->email }}
+
+
+
NPWP
+
{{ $company->tax_id_number }}
+
+
+
SIUP
+
{{ $company->trade_license }}
+
+
+
PKP
+
{{ $company->taxable_enterprise ?? 'Tidak Ada' }}
+
+
+
SPT Tahunan
+
{{ $company->annual_tax_return ?? 'Tidak Ada' }}
+
+
+
Suket Domisili
+
{{ $company->domicile_certificate ?? 'Tidak Ada' }}
+
+
+
Profile
+
{{ $company->profile ?? 'Tidak Ada' }}
+
+
+
Status
+
{{ get_user_status($company->user->status) }}
+
+
+
Status Edit
+
{{ get_edit_status($company->edit_status) }}
+
+
+
+ {{-- Dokumen --}}
+
+
Dokumen
+
+ @php
+ $documents = [
+ 'NIK Direktur' => $company->director_nik_doc,
+ 'Akta Pendirian' => $company->deed_incorporation_doc,
+ 'SIUP' => $company->trade_license_doc,
+ 'NPWP' => $company->tax_id_number_doc,
+ 'PKP' => $company->taxable_enterprise_doc,
+ 'SPT Tahunan' => $company->annual_tax_return_doc,
+ 'Suket Domisili' => $company->domicile_certificate_doc,
+ 'Profile' => $company->profile_doc,
+ ];
+ @endphp
+
+ @foreach($documents as $label => $doc)
+
+
{{ $label }}
+ @if($doc)
+ @php
+ $ext = pathinfo($doc, PATHINFO_EXTENSION);
+ @endphp
+ @if(in_array(strtolower($ext), ['jpg', 'jpeg', 'png', 'gif', 'webp']))
+
 }})
+ @elseif(strtolower($ext) === 'pdf')
+
Lihat Dokumen PDF
+ @else
+ File tidak dikenali.
+ @endif
+ @else
+ Tidak Ada Dokumen
+ @endif
+
+ @endforeach
+
+
+
+
+
+
diff --git a/routes/web.php b/routes/web.php
index 11ef661..f02edfb 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -252,6 +252,7 @@
Route::get('/{id}/{type}/show', 'show')->name('show');
Route::get('/create', 'create')->name('create');
Route::post('/', 'store')->name('store');
+
Route::get('/edit/request', 'editRequest')->name('edit.request');
Route::put('/edit/request', 'editRequestAction')->name('edit.request.action');
Route::get('/edit', 'edit')->name('edit');
@@ -264,6 +265,7 @@
Route::post('/export', 'export')->name('export');
Route::post('/filter', 'filter')->name('filter');
+ Route::get('/{id}/print', 'printData')->name('data.print');
});
Route::get('/data', [DatatableController::class, 'company'])->name('data');