diff --git a/DataTables/DocumentDataTable.php b/DataTables/DocumentDataTable.php index 20abfc8..42cf380 100644 --- a/DataTables/DocumentDataTable.php +++ b/DataTables/DocumentDataTable.php @@ -4,6 +4,7 @@ use Carbon\Carbon; use Illuminate\Database\Eloquent\Builder as QueryBuilder; + use Illuminate\Support\Facades\Auth; use Modules\Cetaklabel\Entities\DocumentDetail; use Yajra\DataTables\EloquentDataTable; use Yajra\DataTables\Html\Builder as HtmlBuilder; @@ -23,9 +24,66 @@ $query = $query->with(['document']); return (new EloquentDataTable($query)) ->filter(function ($query) { + if (request()->has('search')) { $search = request()->get('search'); - $query->where('kode', 'like', "%" . $search['value'] . "%"); + if(Auth::user()->hasRole('otorisator')){ + $query->orWhereRelation('document','directorat_id', Auth::user()->directorat_id); + $query->whereIn('status', [0,4,6,9]); + } else if(Auth::user()->hasRole('operator')){ + $query->orWhereRelation('document','sub_directorat_id', Auth::user()->sub_directorat_id); + } + + $query->where(function($query) use ($search){ + $query->where('kode', 'like', "%" . $search['value'] . "%"); + $query->orWhereRelation('document','kode_dus', 'like', "%" . $search['value'] . "%"); + $query->orWhereRelation('document','kode_odner', 'like', "%" . $search['value'] . "%"); + + $query->orWhereRelation('document.directorat','kode', 'like', "%" . $search['value'] . "%"); + $query->orWhereRelation('document.directorat','name', 'like', "%" . $search['value'] . "%"); + + $query->orWhereRelation('document.sub_directorat','kode', 'like', "%" . $search['value'] . "%"); + $query->orWhereRelation('document.sub_directorat','name', 'like', "%" . $search['value'] . "%"); + + $query->orWhereRelation('document.job','kode', 'like', "%" . $search['value'] . "%"); + $query->orWhereRelation('document.job','name', 'like', "%" . $search['value'] . "%"); + + $query->orWhereRelation('document.sub_job','kode', 'like', "%" . $search['value'] . "%"); + $query->orWhereRelation('document.sub_job','name', 'like', "%" . $search['value'] . "%"); + + $query->orWhereRelation('document.sub_sub_job','kode', 'like', "%" . $search['value'] . "%"); + $query->orWhereRelation('document.sub_sub_job','name', 'like', "%" . $search['value'] . "%"); + + $query->orWhere('tanggal_dokumen', 'like', "%" . $search['value'] . "%"); + $query->orWhere('tanggal_upload', 'like', "%" . $search['value'] . "%"); + $query->orWhere('nama_nasabah', 'like', "%" . $search['value'] . "%"); + $query->orWhere('no_rekening', 'like', "%" . $search['value'] . "%"); + $query->orWhere('no_cif', 'like', "%" . $search['value'] . "%"); + $query->orWhere('group', 'like', "%" . $search['value'] . "%"); + $query->orWhere('nomor_dokumen', 'like', "%" . $search['value'] . "%"); + $query->orWhere('perihal', 'like', "%" . $search['value'] . "%"); + $query->orWhere('kode_cabang', 'like', "%" . $search['value'] . "%"); + $query->orWhere('jumlah_halaman', 'like', "%" . $search['value'] . "%"); + $query->orWhere('custom_field_1', 'like', "%" . $search['value'] . "%"); + $query->orWhere('custom_field_2', 'like', "%" . $search['value'] . "%"); + $query->orWhere('custom_field_3', 'like', "%" . $search['value'] . "%"); + $query->orWhere('custom_field_4', 'like', "%" . $search['value'] . "%"); + $query->orWhere('no_urut', 'like', "%" . $search['value'] . "%"); + $query->orWhere('kategori', 'like', "%" . $search['value'] . "%"); + $query->orWhere('keterangan', 'like', "%" . $search['value'] . "%"); + }); + } + + if(request()->has('tanggalawal')){ + if(request()->get('tanggalawal') != null){ + $query->where('tanggal_dokumen', '>=', Carbon::parse(request()->get('tanggalawal'))->format('Y-m-d')); + } + } + + if(request()->has('tanggalakhir')){ + if(request()->get('tanggalakhir') != null){ + $query->where('tanggal_dokumen', '<=', Carbon::parse(request()->get('tanggalakhir'))->format('Y-m-d')); + } } }) ->addColumn('kode_dus', function ($model) { @@ -57,11 +115,37 @@ ->addColumn('sub_sub_job', function ($model) { return $model->document->sub_sub_job->kode . ' - ' . $model->document->sub_sub_job->name; }) + ->addColumn('tanggal_approve', function ($model) { + if($model->approved_at){ + $dt = Carbon::create($model->approved_at); + return $dt->isoFormat('D MMMM Y H:mm:ss'); + } + + return "-"; + + }) + ->addColumn('approved_by', function ($model) { + return $model->approved->name ?? ""; + }) ->addColumn('status', function ($model) { if ($model->status == 1) { return 'Approved'; } else if ($model->status == 0) { - return 'Menunggu Approval'; + return 'Menunggu Approval'; + } else if ($model->status == 3) { + return 'Rejected'; + } else if ($model->status == 4) { + return 'Approved Request Download'; + } else if ($model->status == 5) { + return 'Approved Download Approved'; + } else if ($model->status == 6) { + return 'Approved Request Delete'; + } else if ($model->status == 7) { + return 'Approved Request Delete'; + } else if ($model->status == 8) { + return 'Deleted'; + } else if ($model->status == 9) { + return 'Approved Request Non-Aktif'; } }) ->addIndexColumn() @@ -115,6 +199,8 @@ Column::make('nomor_dokumen'), Column::make('tanggal_dokumen'), Column::make('jumlah_halaman'), + Column::make('tanggal_approve'), + Column::make('approved_by'), Column::make('directorat')->title('Direktorat')->className('none'), Column::make('sub_directorat')->title('Sub Direktorat')->className('none'), Column::make('job')->title('Jenis Pekerjaan')->className('none'), @@ -127,7 +213,6 @@ Column::computed('action') ->exportable(false) ->printable(false) - ->width(60) ->addClass('text-center'), ]; } diff --git a/Database/Migrations/2023_04_17_135930_create_document_details_table.php b/Database/Migrations/2023_04_17_135930_create_document_details_table.php index c56b6c6..ba950da 100644 --- a/Database/Migrations/2023_04_17_135930_create_document_details_table.php +++ b/Database/Migrations/2023_04_17_135930_create_document_details_table.php @@ -39,14 +39,16 @@ $table->string('keterangan')->nullable(); + $table->string('aktif')->default(0)->nullable(); $table->string('status')->default(0)->nullable(); $table->timestamps(); $table->softDeletes(); - + $table->timestamp('approved_at')->nullable(); $table->unsignedBigInteger('created_by')->nullable(); $table->unsignedBigInteger('updated_by')->nullable(); $table->unsignedBigInteger('deleted_by')->nullable(); + $table->unsignedBigInteger('approved_by')->nullable(); }); } diff --git a/Entities/Document.php b/Entities/Document.php index 43293e2..a2d60ba 100644 --- a/Entities/Document.php +++ b/Entities/Document.php @@ -46,11 +46,6 @@ return $this->belongsTo(SubSubJob::class); } - public function special_code() - { - return $this->belongsTo(SpecialCode::class); - } - public function document_details() { return $this->hasMany(DocumentDetail::class); diff --git a/Entities/DocumentDetail.php b/Entities/DocumentDetail.php index c7e1fb7..8a6f9ad 100644 --- a/Entities/DocumentDetail.php +++ b/Entities/DocumentDetail.php @@ -2,6 +2,8 @@ namespace Modules\Cetaklabel\Entities; + use Modules\Usermanager\Entities\User; + class DocumentDetail extends BaseModel { protected $fillable = [ @@ -27,7 +29,10 @@ 'no_urut', 'kategori', 'keterangan', - 'status' + 'status', + 'approved_by', + 'approved_at', + 'aktif' ]; public function document() @@ -39,4 +44,14 @@ { return $this->belongsTo(DocumentType::class); } + + public function special_code() + { + return $this->belongsTo(SpecialCode::class); + } + + public function approved(){ + return $this->belongsTo(User::class, 'approved_by'); + } + } diff --git a/Http/Controllers/DocumentController.php b/Http/Controllers/DocumentController.php index 57665ad..f31670f 100644 --- a/Http/Controllers/DocumentController.php +++ b/Http/Controllers/DocumentController.php @@ -9,6 +9,7 @@ use Haruncpi\LaravelIdGenerator\IdGenerator; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; + use Illuminate\Support\Facades\View; use Modules\Cetaklabel\DataTables\DocumentDataTable; use Modules\Cetaklabel\Entities\Directorat; use Modules\Cetaklabel\Entities\Document; @@ -22,6 +23,13 @@ use Modules\Cetaklabel\Http\Requests\Document\StoreDocumentRequest; use Modules\Cetaklabel\Http\Requests\Document\UpdateDocumentRequest; use Response; + // Reference the Dompdf namespace + use Dompdf\Dompdf; +// Reference the Options namespace + use Dompdf\Options; +// Reference the Font Metrics namespace + use Dompdf\FontMetrics; + class DocumentController extends Controller { @@ -169,49 +177,45 @@ */ public function edit($id) { - if (is_null($this->user) || !$this->user->can('document.update')) { + if (is_null($this->user) || !$this->user->hasRole('otorisator')){ abort(403, 'Sorry !! You are Unauthorized to update any master data !'); } - $document = Document::find($id); - $directorat = Directorat::all(); - $sub_directorat = SubDirectorat::where('directorat_id', $document->directorat_id)->get(); - $job = Job::where('sub_directorat_id', $document->sub_directorat_id)->get(); - $sub_job = SubJob::where('job_id', $document->job_id)->get(); - $sub_sub_job = SubSubJob::where('sub_job_id', $document->sub_job_id)->get(); - $special_code = SpecialCode::all(); - $document_type = DocumentType::all(); + $document = DocumentDetail::with('document')->find($id); - return view('cetaklabel::app.document.edit', compact('document', 'directorat', 'sub_directorat', 'job', 'sub_job', 'sub_sub_job', 'special_code', 'document_type')); + if ($document->status != '0') { + abort(403, 'Sorry !! This Document has been authorized !'); + } + + $document = DocumentDetail::with('document')->find($id); + + return view('cetaklabel::app.document.edit', compact('document')); } /** * Update the specified resource in storage. */ - public function update(UpdateDocumentRequest $request, Document $documents) + public function update(Request $request) { - if (is_null($this->user) || !$this->user->can('document.update')) { + if (is_null($this->user) || !$this->user->hasRole('otorisator')) { abort(403, 'Sorry !! You are Unauthorized to update any master data !'); } - // Validate the request... - $validated = $request->validated(); + try { + $data = [ + 'status' => $request->keterangan =="" ? '1' : '3', + 'keterangan' => $request->keterangan ?? null, + 'approved_at' => date('Y-m-d H:i:s'), + 'approved_by' => $this->user->id + ]; + $documents = DocumentDetail::find($request->id); + $documents->update($data); - // Update the Document... - if ($validated) { - try { - $document = Document::find($request->id); - $update = $document->update($validated); - - - return redirect()->route('document.index')->with('success', 'Document updated successfully.'); - } catch (Exception $e) { - return redirect()->route('document.index')->with('error', 'Document updated failed.'); - } + echo json_encode(['status' => 'success', 'message' => 'Document updated successfully.']); + } catch (Exception $e) { + echo json_encode(['status' => 'error', 'message' => 'Document updated failed.']); } - - return false; } /** @@ -236,14 +240,48 @@ public function download(Request $request) { + if (is_null($this->user) || !$this->user->can('document.read')) { abort(403, 'Sorry !! You are Unauthorized to download any master data !'); } $document = DocumentDetail::find($request->id); + if($document->status == 1){ + $document->update(['status' => '4']); + echo json_encode(['status' => 'success', 'message' => 'Document menunggu Approval untuk di Cetak.']); + return; + } - $filepath = public_path($document->file); - return Response::download($filepath); + if($document->status == 4){ + $document->update(['status' => '5']); + echo json_encode(['status' => 'success', 'message' => 'Approval Berhasil.']); + return; + } + + if($document->status == 5){ + $document->update(['status' => '1']); + $document->save(); + $filepath = public_path($document->file); + return Response::download($filepath); + + } + + } + + public function aktif(Request $request) + { + $document = DocumentDetail::find($request->id); + if($document->aktif == 1 && $document->status != 9){ + $document->update(['status' => '9','keterangan' => $request->keterangan]); + echo json_encode(['status' => 'success', 'message' => 'Document menunggu Approval untuk di Nonaktifkan.']); + return; + } + + if($document->aktif == 1 && $document->status == 9){ + $document->update(['aktif' => '0','status' => '1']); + echo json_encode(['status' => 'success', 'message' => 'Document Berhasil di Nonaktifkan.']); + return; + } } public function label(Request $request) @@ -266,7 +304,16 @@ $last = Carbon::create($last); $last = $last->isoFormat('DD MMMM Y'); + activity() + ->performedOn($document) + ->location('id') + ->causedBy(Auth::user()) + ->withProperties($document) + ->log('Cetak Label Dus'); + return view('cetaklabel::app.document.label', compact('document_detail', 'start', 'last', 'document')); + + } public function odner(Request $request) @@ -289,6 +336,13 @@ $last = Carbon::create($last); $last = $last->isoFormat('DD MMMM Y'); + activity() + ->performedOn($document) + ->location('id') + ->causedBy(Auth::user()) + ->withProperties($document) + ->log('Cetak Label Odner'); + return view('cetaklabel::app.document.odner', compact('document_detail', 'start', 'last', 'document')); } } diff --git a/Http/Controllers/SettingsController.php b/Http/Controllers/SettingsController.php index 6abcec3..583a8fc 100644 --- a/Http/Controllers/SettingsController.php +++ b/Http/Controllers/SettingsController.php @@ -6,6 +6,9 @@ use Illuminate\Contracts\Support\Renderable; use Illuminate\Http\Request; use Illuminate\Routing\Controller; + use Illuminate\Support\Facades\Auth; + use Modules\Cetaklabel\Entities\Document; + use Modules\Cetaklabel\Entities\DocumentDetail; class SettingsController extends Controller { diff --git a/Http/Requests/Document/StoreDocumentRequest.php b/Http/Requests/Document/StoreDocumentRequest.php index bdfed6a..7bc00ef 100644 --- a/Http/Requests/Document/StoreDocumentRequest.php +++ b/Http/Requests/Document/StoreDocumentRequest.php @@ -106,7 +106,7 @@ if($sum_halaman_document < Setting::get('maximal_halaman_per_dus')){ if(($sum_halaman_document + $this->jumlah_halaman) >= Setting::get('maximal_halaman_per_dus')){ - $sequence_odner += $this->sequence; + $sequence_odner += 1; } else { $sequence_odner = $this->sequence; } @@ -115,10 +115,10 @@ $sum_halaman_document = $this->sumHalaman($prefix,$i,$sequence_dus); if($sum_halaman_document < Setting::get('maximal_halaman_per_odner')){ if(($sum_halaman_document + $this->jumlah_halaman) >= Setting::get('maximal_halaman_per_odner')){ - $sequence_odner += $i; + $sequence_odner = $i + 1; break; } else { - $sequence_odner = $i; + $sequence_odner = $this->sequence; break; } } diff --git a/Resources/views/app/document/_action.blade.php b/Resources/views/app/document/_action.blade.php index 5f1c1bb..e4132e1 100644 --- a/Resources/views/app/document/_action.blade.php +++ b/Resources/views/app/document/_action.blade.php @@ -2,30 +2,64 @@ $route = explode('.', Route::currentRouteName()); @endphp
- - Dus - - - Odner - - - {!! getIcon("cloud-download", "fs-1 text-info","duotune") !!} - - - @if(Auth::user()->can($route[0].'.update')) - - {!! getIcon("pencil", "fs-1 text-warning","duotune") !!} + @if(in_array($model->status,[1,4,5,6,7,9]) && Auth::user()->can($route[0].'.read')) + + {!! getIcon("printer", "text-success","duotune") !!} Label Dus + + {!! getIcon("printer", "text-primary","duotune") !!} Odner + + @if($model->status == 4 && Auth::user()->hasRole('otorisator')) + + {!! getIcon("cloud-download", "text-info","duotune") !!} Approve Download + + @elseif($model->status == 1 && Auth::user()->hasRole('otorisator')) + + {!! getIcon("cloud-download", "text-info","duotune") !!} Request Download + + @elseif($model->status == 5 && Auth::user()->hasRole('operator')) + + {!! getIcon("cloud-download", "text-success","duotune") !!} Download + + @endif + + @if(Auth::user()->can($route[0].'.delete')) + @if( Auth::user()->hasRole('operator')) + + @if($model->aktif == 1) + {!! getIcon("check-square", "text-success","duotune") !!} Aktif + @else + {!! getIcon("cross-square", "text-danger","duotune") !!} Tidak Aktif + @endif + + @elseif( Auth::user()->hasRole('otorisator')) + + {!! getIcon("check-square", "text-success","duotune") !!} Approve Non Aktif + + @endif + @endif + + @if(Auth::user()->can($route[0].'.delete')) + {!! Form::open(['method' => 'DELETE','route' => [$route[0].'.destroy', $model->id],'class'=>'']) !!} + {{ Form::button(getIcon("trash", "text-danger","duotune")." Delete", ['type' => 'submit', 'class' => 'delete btn btn-bg-light btn-active-light-danger btn-sm'] ) }} + {!! Form::close() !!} + @endif + + @elseif($model->status == 0) + @if(Auth::user()->hasRole('otorisator')) + + {!! getIcon("eye", "text-warning","duotune") !!} View + + @endif @endif - @if(Auth::user()->can($route[0].'.delete')) - {!! Form::open(['method' => 'DELETE','route' => [$route[0].'.destroy', $model->id],'class'=>'']) !!} - {{ Form::button(getIcon("trash", "fs-1 text-danger","duotune"), ['type' => 'submit', 'class' => 'delete btn btn-icon btn-bg-light btn-active-light-danger btn-sm'] ) }} - {!! Form::close() !!} - @endif
diff --git a/Resources/views/app/document/_edit.blade.php b/Resources/views/app/document/_edit.blade.php index 4d3e7cc..1957e96 100644 --- a/Resources/views/app/document/_edit.blade.php +++ b/Resources/views/app/document/_edit.blade.php @@ -1,222 +1,359 @@ @php $route = explode('.', Route::currentRouteName()); @endphp - -
- @method('PUT') - @csrf - -
- - - - - +
+
+ + + @method('PUT') + @csrf + + +
+ + + + +
+ +
- +
-
-
- -
- - - - -
- -
-
- -
- - - - -
- -
-
- -
- - - - -
- -
-
- -
- - - - -
- -
+ +
+ +
+ +
+ +

+ {{ $document->nomor_dokumen }} +

+ -
- -
- - - - -
- -
+ +
+ + + -
- -
- - - - -
- -
+ +
Tanggal Dokumen : {{ $document->tanggal_dokumen }}
+ +
+ + +
+ + + -
- -
- - - - -
- -
+ +
User Upload : {{ $document->creator->name }}
+ +
+ -
- -
- - - - + +
+ + + + + +
Tanggal Upload : {{ $document->tanggal_upload }}
+ +
+ + + +
+ + + + + +
Sequence : {{ $document->document->sequence_odner }}
+ +
+ + + +
+ + + + + +
Halaman : {{ $document->jumlah_halaman }}
+ +
+ + + +
+ +
+ + + +
+ +

+ Keterangan +

+ + + +
+ +
+ + + + + +
{{ $document->custom_field_1 }}
+ +
+ + +
+ + + + + +
{{ $document->custom_field_2 }}
+ +
+ + +
+ + + + + +
{{ $document->custom_field_3 }}
+ +
+ + +
+ + + + + +
{{ $document->custom_field_4 }}
+ +
+ +
+
+ + +
+ +

+ Info Direktorat +

+ + + +
+ +
+ + + + + +
Direktorat {{ $document->document->directorat->name }}
+ +
+ + +
+ + + + + +
Sub Direktorat {{ $document->document->sub_directorat->name }}
+ +
+ + +
+ + + + + +
Jenis Pekerjaan {{ $document->document->job->name }}
+ +
+ + +
+ + + + + +
Sub Jenis Pekerjaan {{ $document->document->sub_job->name }}
+ +
+ + + +
+ + + + + +
Sub Sub Jenis Pekerjaan {{ $document->document->sub_sub_job->name }}
+ +
+ +
+ +
+
- +
+ +
- - -
- - -
- - - - +
@push('customscript') @endpush diff --git a/Resources/views/app/document/_form.blade.php b/Resources/views/app/document/_form.blade.php index 534c9f4..b49e3ce 100644 --- a/Resources/views/app/document/_form.blade.php +++ b/Resources/views/app/document/_form.blade.php @@ -328,7 +328,7 @@ title="Specify a target name for future usage and reference"> - +
diff --git a/Resources/views/app/document/_table.blade.php b/Resources/views/app/document/_table.blade.php index 86f215a..eccd4e1 100644 --- a/Resources/views/app/document/_table.blade.php +++ b/Resources/views/app/document/_table.blade.php @@ -4,7 +4,171 @@ {{-- Inject Scripts --}} @section('scripts') - {{ $dataTable->scripts() }} + @endsection @push('customscript') @@ -17,6 +181,14 @@ LaravelDataTables["{{$route[0]}}-table"].search(this.value).draw(); }); + $("#tanggalawal").on("change", function () { + LaravelDataTables["{{$route[0]}}-table"].search($("#searchbox").val()).draw(); + }); + + $("#tanggalakhir").on("change", function () { + LaravelDataTables["{{$route[0]}}-table"].search($("#searchbox").val()).draw(); + }); + $(function () { const documentTitle = '{{ ucfirst($route[0]) }} Report'; var buttons = new $.fn.dataTable.Buttons(LaravelDataTables["{{$route[0]}}-table"], { @@ -49,7 +221,6 @@ exportButtons.forEach(exportButton => { exportButton.addEventListener('click', e => { e.preventDefault(); - console.log(e.target.getAttribute('data-kt-export')); // Get clicked export value const exportValue = e.target.getAttribute('data-kt-export'); const target = document.querySelector('.dt-buttons .buttons-' + exportValue); @@ -59,6 +230,120 @@ }); }); + LaravelDataTables["{{$route[0]}}-table"].on('click', '.btn-download', function (event) { + var form = $(this).closest("a"); + event.preventDefault(); + Swal.fire({ + title: 'Are you sure?', + text: "Request download file?", + icon: 'warning', + showCancelButton: true, + confirmButtonColor: '#3085d6', + cancelButtonColor: '#d33', + confirmButtonText: 'Yes' + }).then((result) => { + if (result.isConfirmed) { + $.ajax({ + type: "GET", + url: form.attr('href'),// serializes the form's elements. + success: function (data) { + toastr.success('{{ucfirst($route[0])}} menunggu approval untuk mencetak dokumen.', 'Success!', {timeOut: 5000}); + LaravelDataTables["{{$route[0]}}-table"].draw(); + } + }); + + } + }) + }) + + LaravelDataTables["{{$route[0]}}-table"].on('click', '.btn-aktif', function (event) { + var form = $(this).closest("a"); + event.preventDefault(); + Swal.fire({ + title: 'Are you sure?', + html: "Apakah Anda Akan Menonaktifka Dokumen Ini!
Alasan Penonaktifan :", + icon: 'warning', + input: 'text', + showCancelButton: true, + confirmButtonColor: '#3085d6', + cancelButtonColor: '#d33', + confirmButtonText: 'Yes!', + preConfirm: (keterangan) => { + if (!keterangan) { + Swal.showValidationMessage( + `Alasan Penonaktifan Wajib Diisi` + ) + } else { + this.keterangan = keterangan + } + } + }).then((result) => { + if (result.isConfirmed) { + $.ajax({ + type: "GET", + url: form.attr('href'), + data: {keterangan:this.keterangan}, // serializes the form's elements. + success: function (data) { + toastr.success('Menunggu Approval untuk menonaktifkan Dokumen.', 'Success!', {timeOut: 5000}); + LaravelDataTables["{{$route[0]}}-table"].draw(); + } + }); + + } + }) + }) + + LaravelDataTables["{{$route[0]}}-table"].on('click', '.approve-download', function (event) { + var form = $(this).closest("a"); + event.preventDefault(); + Swal.fire({ + title: 'Are you sure?', + text: "Approve download file?", + icon: 'warning', + showCancelButton: true, + confirmButtonColor: '#3085d6', + cancelButtonColor: '#d33', + confirmButtonText: 'Yes' + }).then((result) => { + if (result.isConfirmed) { + $.ajax({ + type: "GET", + url: form.attr('href'),// serializes the form's elements. + success: function (data) { + toastr.success('{{ucfirst($route[0])}} Approval Download Berhasil.', 'Success!', {timeOut: 5000}); + LaravelDataTables["{{$route[0]}}-table"].draw(); + } + }); + + } + }) + }) + + LaravelDataTables["{{$route[0]}}-table"].on('click', '.btn-approve-aktif', function (event) { + var form = $(this).closest("a"); + event.preventDefault(); + Swal.fire({ + title: 'Are you sure?', + text: "Anda Akan Mengijinkan Menonaktifkan Dokumen Ini?", + icon: 'warning', + showCancelButton: true, + confirmButtonColor: '#3085d6', + cancelButtonColor: '#d33', + confirmButtonText: 'Yes' + }).then((result) => { + if (result.isConfirmed) { + $.ajax({ + type: "GET", + url: form.attr('href'),// serializes the form's elements. + success: function (data) { + toastr.success('{{ucfirst($route[0])}} Approval Penonaktifan Dokumen Berhasil.', 'Success!', {timeOut: 5000}); + LaravelDataTables["{{$route[0]}}-table"].draw(); + } + }); + + } + }) + }) LaravelDataTables["{{$route[0]}}-table"].on('click', '.delete', function (event) { var form = $(this).closest("form"); @@ -79,7 +364,7 @@ data: form.serialize(), // serializes the form's elements. success: function (data) { toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000}); - LaravelDataTables["{{$route[0]}}-table"].ajax.reload(); + LaravelDataTables["{{$route[0]}}-table"].draw(); } }); diff --git a/Resources/views/app/document/edit.blade.php b/Resources/views/app/document/edit.blade.php index 6fc71f2..8fa948c 100644 --- a/Resources/views/app/document/edit.blade.php +++ b/Resources/views/app/document/edit.blade.php @@ -4,7 +4,7 @@

- Edit Document {{ $document->kode }} + View Document {{ $document->kode }}

diff --git a/Resources/views/app/document/index.blade.php b/Resources/views/app/document/index.blade.php index 2b99046..36d69dd 100644 --- a/Resources/views/app/document/index.blade.php +++ b/Resources/views/app/document/index.blade.php @@ -19,6 +19,14 @@ + +  Periode :  + +  s.d. 
diff --git a/Resources/views/app/document/label.blade.php b/Resources/views/app/document/label.blade.php index 4fc9803..e85986f 100644 --- a/Resources/views/app/document/label.blade.php +++ b/Resources/views/app/document/label.blade.php @@ -49,11 +49,9 @@ right: 75px; } } - - @@ -69,8 +67,8 @@ {{ $document_detail->document->directorat->kode }}.{{ $document_detail->document->sub_directorat->kode }}
{{ $document_detail->document->job->kode }}

{{ $document_detail->document->job->name }}



- {{ $document_detail->document->sequence_dus }}



- PERIODE + {{ $document_detail->document->sequence_dus }}




+ PERIODE @@ -139,5 +137,9 @@
+ + diff --git a/Resources/views/app/document/odner.blade.php b/Resources/views/app/document/odner.blade.php index d6f2f03..2446502 100644 --- a/Resources/views/app/document/odner.blade.php +++ b/Resources/views/app/document/odner.blade.php @@ -53,5 +53,9 @@ + + diff --git a/Resources/views/app/setting/_form.blade.php b/Resources/views/app/setting/_form.blade.php index 023c4e2..7835deb 100644 --- a/Resources/views/app/setting/_form.blade.php +++ b/Resources/views/app/setting/_form.blade.php @@ -16,7 +16,7 @@ title="Specify a target name for future usage and reference"> -
@@ -32,7 +32,7 @@ title="Specify a target name for future usage and reference"> - diff --git a/Routes/web.php b/Routes/web.php index 5d65b66..5ee47a1 100644 --- a/Routes/web.php +++ b/Routes/web.php @@ -35,6 +35,7 @@ Route::get('document-download/{id}', [DocumentController::class, 'download'])->name('document.download'); Route::get('document-label/{id}', [DocumentController::class, 'label'])->name('document.label'); Route::get('document-odner/{id}', [DocumentController::class, 'odner'])->name('document.odner'); + Route::get('document-aktif/{id}', [DocumentController::class, 'aktif'])->name('document.aktif'); //Route::resource('document-detail', DOcumentDetailController::class); Route::resource('settings', SettingsController::class);