added forms country & vehicle running cost (kurang fitur pendukung)
This commit is contained in:
@@ -68,6 +68,7 @@ AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
|
||||
NEXT_CLOUD_URL=https://mkt.tunggal-pharma.com/
|
||||
NEXT_CLOUD_URL=https://mkt.tunggal-pharma.com/remote.php/dav/files/user_dev/
|
||||
NEXT_CLOUD_USERNAME=user_dev
|
||||
NEXT_CLOUD_PASSWORD=userdev12345
|
||||
NEXT_CLOUD_PATHPREFIX=""
|
||||
|
||||
@@ -6,40 +6,189 @@ use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\FormUpCountry;
|
||||
use App\Models\Rayon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Models\Region;
|
||||
use App\Models\Cabang;
|
||||
use App\Models\UserHasCabang;
|
||||
use App\Models\Kategori;
|
||||
|
||||
class FormUpCountryController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('backend.pages.forms.upcountry.index');
|
||||
}
|
||||
$this->checkAuthorization(auth()->user(), ['forms.country.view']);
|
||||
|
||||
$forms = FormUpCountry::with('rayon')->where('user_id', auth()->user()->id)->get();
|
||||
return view('backend.pages.forms.upcountry.index', [
|
||||
'forms' => $forms
|
||||
]);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.country.create']);
|
||||
|
||||
return view('backend.pages.forms.upcountry.create', [
|
||||
'rayons' => Rayon::all()
|
||||
]);
|
||||
}
|
||||
|
||||
public function store()
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.country.create']);
|
||||
|
||||
$request->validate([
|
||||
'rayon_id' => 'required|exists:rayon,id',
|
||||
'tanggal' => 'required',
|
||||
'tujuan' => 'required',
|
||||
'jarak' => 'required',
|
||||
'allowance' => 'required',
|
||||
'transport_dalkot' => 'required',
|
||||
'transport_ankot' => 'required',
|
||||
'hotel' => 'required',
|
||||
'total' => 'required',
|
||||
'bukti1' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
||||
'bukti2' => 'nullable|file|mimes:xlsx,xls,csv',
|
||||
'bukti3' => 'nullable|file|mimes:pdf',
|
||||
]);
|
||||
|
||||
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
||||
$region = Region::where('id', $cabang->region_id)->first();
|
||||
$kategori = Kategori::where('name', 'Up Country')->first();
|
||||
|
||||
$filePaths = [];
|
||||
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/upcountry/';
|
||||
|
||||
// check if folder not exists
|
||||
// if (!Storage::disk('nextcloud')->exists(trim($folderPath, '/'))) {
|
||||
// Storage::disk('nextcloud')->makeDirectory(trim($folderPath, '/'));
|
||||
// }
|
||||
|
||||
// Store files to Nextcloud and collect their paths
|
||||
if ($request->hasFile('bukti1')) {
|
||||
$filePaths['bukti1'] = Storage::disk('nextcloud')->putFileAs($folderPath, $request->file('bukti1'), $request->file('bukti1')->getClientOriginalName());
|
||||
}
|
||||
if ($request->hasFile('bukti2')) {
|
||||
$filePaths['bukti2'] = Storage::disk('nextcloud')->putFileAs($folderPath, $request->file('bukti2'), $request->file('bukti2')->getClientOriginalName());
|
||||
}
|
||||
if ($request->hasFile('bukti3')) {
|
||||
$filePaths['bukti3'] = Storage::disk('nextcloud')->putFileAs($folderPath, $request->file('bukti3'), $request->file('bukti3')->getClientOriginalName());
|
||||
}
|
||||
|
||||
// Generate sequence number and expense number
|
||||
$sequence_number = FormUpCountry::withTrashed()->where('expense_number', 'like', $region->code . '-' . $cabang->code . '-UPC-' . date('ym') . '%')->count() + 1;
|
||||
$formatted_sequence_number = str_pad($sequence_number, 4, '0', STR_PAD_LEFT);
|
||||
$expense_number = $region->code . '-' . $cabang->code . '-UPC-' . date('ym') . $formatted_sequence_number;
|
||||
|
||||
// Save the form data
|
||||
FormUpCountry::create([
|
||||
'expense_number' => $expense_number,
|
||||
'user_id' => auth()->user()->id,
|
||||
'rayon_id' => $request->rayon_id,
|
||||
'tanggal' => $request->tanggal,
|
||||
'tujuan' => $request->tujuan,
|
||||
'jarak' => $request->jarak,
|
||||
'allowance' => $request->allowance,
|
||||
'transport_dalkot' => $request->transport_dalkot,
|
||||
'transport_ankot' => $request->transport_ankot,
|
||||
'hotel' => $request->hotel,
|
||||
'total' => $request->total,
|
||||
'bukti1' => $filePaths['bukti1'] ?? null,
|
||||
'bukti2' => $filePaths['bukti2'] ?? null,
|
||||
'bukti3' => $filePaths['bukti3'] ?? null,
|
||||
'account_number' => $kategori->account_number,
|
||||
'status' => 'On Progress',
|
||||
]);
|
||||
|
||||
session()->flash('success', 'Form has been created.');
|
||||
return redirect()->route('forms.up-country');
|
||||
}
|
||||
|
||||
public function edit()
|
||||
public function edit($id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.country.edit']);
|
||||
|
||||
$form = FormUpCountry::with('rayon')->findOrfail($id);
|
||||
return view('backend.pages.forms.upcountry.edit', [
|
||||
'rayons' => Rayon::all()
|
||||
'rayons' => Rayon::all(),
|
||||
'form' => $form
|
||||
]);
|
||||
}
|
||||
|
||||
public function update()
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.country.edit']);
|
||||
|
||||
$request->validate([
|
||||
'rayon_id' => 'required|exists:rayon,id',
|
||||
'tanggal' => 'required',
|
||||
'tujuan' => 'required',
|
||||
'jarak' => 'required',
|
||||
'allowance' => 'required',
|
||||
'transport_dalkot' => 'required',
|
||||
'transport_ankot' => 'required',
|
||||
'hotel' => 'required',
|
||||
'total' => 'required',
|
||||
'bukti1' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
||||
'bukti2' => 'nullable|file|mimes:xlsx,xls,csv',
|
||||
'bukti3' => 'nullable|file|mimes:pdf',
|
||||
]);
|
||||
|
||||
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
||||
$region = Region::where('id', $cabang->region_id)->first();
|
||||
$kategori = Kategori::where('name', 'Up Country')->first();
|
||||
|
||||
$filePaths = [];
|
||||
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/upcountry/';
|
||||
|
||||
// check if folder not exists
|
||||
// if (!Storage::disk('nextcloud')->exists(trim($folderPath, '/'))) {
|
||||
// Storage::disk('nextcloud')->makeDirectory(trim($folderPath, '/'));
|
||||
// }
|
||||
|
||||
// Store files to Nextcloud and collect their paths
|
||||
if ($request->hasFile('bukti1')) {
|
||||
$filePaths['bukti1'] = Storage::disk('nextcloud')->putFileAs($folderPath, $request->file('bukti1'), $request->file('bukti1')->getClientOriginalName());
|
||||
}
|
||||
if ($request->hasFile('bukti2')) {
|
||||
$filePaths['bukti2'] = Storage::disk('nextcloud')->putFileAs($folderPath, $request->file('bukti2'), $request->file('bukti2')->getClientOriginalName());
|
||||
}
|
||||
if ($request->hasFile('bukti3')) {
|
||||
$filePaths['bukti3'] = Storage::disk('nextcloud')->putFileAs($folderPath, $request->file('bukti3'), $request->file('bukti3')->getClientOriginalName());
|
||||
}
|
||||
|
||||
// Save the form data
|
||||
$form = FormUpCountry::findOrfail($id);
|
||||
$form->update([
|
||||
'rayon_id' => $request->rayon_id,
|
||||
'tanggal' => $request->tanggal,
|
||||
'tujuan' => $request->tujuan,
|
||||
'jarak' => $request->jarak,
|
||||
'allowance' => $request->allowance,
|
||||
'transport_dalkot' => $request->transport_dalkot,
|
||||
'transport_ankot' => $request->transport_ankot,
|
||||
'hotel' => $request->hotel,
|
||||
'total' => $request->total,
|
||||
'bukti1' => $filePaths['bukti1'] ?? $form->bukti1,
|
||||
'bukti2' => $filePaths['bukti2'] ?? $form->bukti2,
|
||||
'bukti3' => $filePaths['bukti3'] ?? $form->bukti3,
|
||||
'account_number' => $kategori->account_number,
|
||||
'status' => 'On Progress',
|
||||
]);
|
||||
|
||||
session()->flash('success', 'Form has been updated.');
|
||||
return redirect()->route('forms.up-country');
|
||||
}
|
||||
|
||||
public function destroy()
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.country.delete']);
|
||||
|
||||
$form = FormUpCountry::findOrfail($id);
|
||||
$form->delete();
|
||||
|
||||
session()->flash('success', 'Form has been deleted.');
|
||||
return redirect()->route('forms.up-country');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Forms;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\FormVehicleRunningCost;
|
||||
use App\Models\Rayon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Models\Region;
|
||||
use App\Models\Cabang;
|
||||
use App\Models\UserHasCabang;
|
||||
use App\Models\Kategori;
|
||||
|
||||
class FormVehicleController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.vehicle.view']);
|
||||
|
||||
$forms = FormVehicleRunningCost::where('user_id', auth()->user()->id)->get();
|
||||
return view('backend.pages.forms.vehicle.index', [
|
||||
'forms' => $forms
|
||||
]);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.vehicle.create']);
|
||||
|
||||
return view('backend.pages.forms.vehicle.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.vehicle.create']);
|
||||
|
||||
$request->validate([
|
||||
'tanggal' => 'required',
|
||||
'liter' => 'required',
|
||||
'harga' => 'required',
|
||||
'jarak' => 'required',
|
||||
'tipe_bensin' => 'required|in:pertalite,pertamax',
|
||||
'nopol' => 'required',
|
||||
'keterangan' => 'required',
|
||||
'bukti1' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
||||
'bukti2' => 'nullable|file|mimes:xlsx,xls,csv',
|
||||
'bukti3' => 'nullable|file|mimes:pdf',
|
||||
]);
|
||||
|
||||
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
||||
$region = Region::where('id', $cabang->region_id)->first();
|
||||
$kategori = Kategori::where('name', 'Vehicle Running Cost')->first();
|
||||
|
||||
$filePaths = [];
|
||||
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/vehicle/';
|
||||
|
||||
// check if folder not exists
|
||||
// if (!Storage::disk('nextcloud')->exists(trim($folderPath, '/'))) {
|
||||
// Storage::disk('nextcloud')->makeDirectory(trim($folderPath, '/'));
|
||||
// }
|
||||
|
||||
// Store files to Nextcloud and collect their paths
|
||||
if ($request->hasFile('bukti1')) {
|
||||
$filePaths['bukti1'] = Storage::disk('nextcloud')->putFileAs($folderPath, $request->file('bukti1'), $request->file('bukti1')->getClientOriginalName());
|
||||
}
|
||||
if ($request->hasFile('bukti2')) {
|
||||
$filePaths['bukti2'] = Storage::disk('nextcloud')->putFileAs($folderPath, $request->file('bukti2'), $request->file('bukti2')->getClientOriginalName());
|
||||
}
|
||||
if ($request->hasFile('bukti3')) {
|
||||
$filePaths['bukti3'] = Storage::disk('nextcloud')->putFileAs($folderPath, $request->file('bukti3'), $request->file('bukti3')->getClientOriginalName());
|
||||
}
|
||||
|
||||
// Generate sequence number and expense number
|
||||
$sequence_number = FormVehicleRunningCost::withTrashed()->where('expense_number', 'like', $region->code . '-' . $cabang->code . '-VHC-' . date('ym') . '%')->count() + 1;
|
||||
$formatted_sequence_number = str_pad($sequence_number, 4, '0', STR_PAD_LEFT);
|
||||
$expense_number = $region->code . '-' . $cabang->code . '-VHC-' . date('ym') . $formatted_sequence_number;
|
||||
|
||||
// Save the form data
|
||||
FormVehicleRunningCost::create([
|
||||
'expense_number' => $expense_number,
|
||||
'user_id' => auth()->user()->id,
|
||||
'tanggal' => $request->tanggal,
|
||||
'liter' => $request->liter,
|
||||
'harga' => $request->harga,
|
||||
'jarak' => $request->jarak,
|
||||
'tipe_bensin' => $request->tipe_bensin,
|
||||
'nopol' => $request->nopol,
|
||||
'keterangan' => $request->keterangan,
|
||||
'bukti1' => $filePaths['bukti1'] ?? null,
|
||||
'bukti2' => $filePaths['bukti2'] ?? null,
|
||||
'bukti3' => $filePaths['bukti3'] ?? null,
|
||||
'account_number' => $kategori->account_number,
|
||||
'status' => 'On Progress',
|
||||
]);
|
||||
|
||||
session()->flash('success', 'Form has been created.');
|
||||
return redirect()->route('forms.vehicle');
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.vehicle.edit']);
|
||||
|
||||
$form = FormVehicleRunningCost::findOrfail($id);
|
||||
return view('backend.pages.forms.vehicle.edit', [
|
||||
'form' => $form
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.vehicle.edit']);
|
||||
|
||||
$request->validate([
|
||||
'tanggal' => 'required',
|
||||
'liter' => 'required',
|
||||
'harga' => 'required',
|
||||
'jarak' => 'required',
|
||||
'tipe_bensin' => 'required|in:pertalite,pertamax',
|
||||
'nopol' => 'required',
|
||||
'keterangan' => 'required',
|
||||
'bukti1' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
||||
'bukti2' => 'nullable|file|mimes:xlsx,xls,csv',
|
||||
'bukti3' => 'nullable|file|mimes:pdf',
|
||||
]);
|
||||
|
||||
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
||||
$region = Region::where('id', $cabang->region_id)->first();
|
||||
$kategori = Kategori::where('name', 'Vehicle Running Cost')->first();
|
||||
|
||||
$filePaths = [];
|
||||
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/vehicle/';
|
||||
|
||||
// check if folder not exists
|
||||
// if (!Storage::disk('nextcloud')->exists(trim($folderPath, '/'))) {
|
||||
// Storage::disk('nextcloud')->makeDirectory(trim($folderPath, '/'));
|
||||
// }
|
||||
|
||||
// Store files to Nextcloud and collect their paths
|
||||
if ($request->hasFile('bukti1')) {
|
||||
$filePaths['bukti1'] = Storage::disk('nextcloud')->putFileAs($folderPath, $request->file('bukti1'), $request->file('bukti1')->getClientOriginalName());
|
||||
}
|
||||
if ($request->hasFile('bukti2')) {
|
||||
$filePaths['bukti2'] = Storage::disk('nextcloud')->putFileAs($folderPath, $request->file('bukti2'), $request->file('bukti2')->getClientOriginalName());
|
||||
}
|
||||
if ($request->hasFile('bukti3')) {
|
||||
$filePaths['bukti3'] = Storage::disk('nextcloud')->putFileAs($folderPath, $request->file('bukti3'), $request->file('bukti3')->getClientOriginalName());
|
||||
}
|
||||
|
||||
// Save the form data
|
||||
$form = FormVehicleRunningCost::findOrfail($id);
|
||||
$form->update([
|
||||
'tanggal' => $request->tanggal,
|
||||
'liter' => $request->liter,
|
||||
'harga' => $request->harga,
|
||||
'jarak' => $request->jarak,
|
||||
'tipe_bensin' => $request->tipe_bensin,
|
||||
'nopol' => $request->nopol,
|
||||
'keterangan' => $request->keterangan,
|
||||
'bukti1' => $filePaths['bukti1'] ?? $form->bukti1,
|
||||
'bukti2' => $filePaths['bukti2'] ?? $form->bukti2,
|
||||
'bukti3' => $filePaths['bukti3'] ?? $form->bukti3,
|
||||
'account_number' => $kategori->account_number,
|
||||
'status' => 'On Progress',
|
||||
]);
|
||||
|
||||
session()->flash('success', 'Form has been updated.');
|
||||
return redirect()->route('forms.vehicle');
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.vehicle.delete']);
|
||||
|
||||
$form = FormVehicleRunningCost::findOrfail($id);
|
||||
$form->delete();
|
||||
|
||||
session()->flash('success', 'Form has been deleted.');
|
||||
return redirect()->route('forms.vehicle');
|
||||
}
|
||||
}
|
||||
@@ -28,4 +28,14 @@ class FormUpCountry extends Model
|
||||
'account_number',
|
||||
'status',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Admin');
|
||||
}
|
||||
|
||||
public function rayon()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Rayon');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,4 +26,9 @@ class FormVehicleRunningCost extends Model
|
||||
'account_number',
|
||||
'status',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Admin', 'user_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,4 +14,14 @@ class UserHasCabang extends Model
|
||||
'user_id',
|
||||
'cabang_id',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Admin');
|
||||
}
|
||||
|
||||
public function cabang()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Cabang');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"laravolt/avatar": "^6.0",
|
||||
"nino/laravel-nextcloud-fs": "^2.0",
|
||||
"phpoffice/phpspreadsheet": "^3.5",
|
||||
"singlequote/laravel-webdav": "^1.1",
|
||||
"spatie/laravel-html": "^3.11",
|
||||
"spatie/laravel-menu": "^4.2",
|
||||
"spatie/laravel-permission": "^6.10",
|
||||
|
||||
Generated
+60
-1
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "e20816a5ac8758dcf14572597c4d7627",
|
||||
"content-hash": "83771e2a711327eac79ef3f7b30673da",
|
||||
"packages": [
|
||||
{
|
||||
"name": "barryvdh/laravel-dompdf",
|
||||
@@ -4797,6 +4797,65 @@
|
||||
},
|
||||
"time": "2024-09-06T07:37:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "singlequote/laravel-webdav",
|
||||
"version": "1.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/singlequote/laravel-webdav.git",
|
||||
"reference": "07bb4f177fc61b65d7dd0aaa37779a82ff100681"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/singlequote/laravel-webdav/zipball/07bb4f177fc61b65d7dd0aaa37779a82ff100681",
|
||||
"reference": "07bb4f177fc61b65d7dd0aaa37779a82ff100681",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"laravel/framework": ">=10",
|
||||
"league/flysystem-webdav": "^3.15",
|
||||
"php": "^8.1"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"aliases": {
|
||||
"WebDav": "SingleQuote\\WebDav\\WebDavFacade"
|
||||
},
|
||||
"providers": [
|
||||
"SingleQuote\\WebDav\\WebDavServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"SingleQuote\\WebDav\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Wim Pruiksma",
|
||||
"email": "wim@quotec.nl",
|
||||
"homepage": "https://quotec.nl/"
|
||||
}
|
||||
],
|
||||
"homepage": "https://github.com/singlequote/laravel-webdav",
|
||||
"keywords": [
|
||||
"Flysystem",
|
||||
"WebDAV",
|
||||
"filesystem",
|
||||
"laravel"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/singlequote/laravel-webdav/issues",
|
||||
"source": "https://github.com/singlequote/laravel-webdav/tree/1.1.1"
|
||||
},
|
||||
"time": "2024-06-07T12:41:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-html",
|
||||
"version": "3.11.1",
|
||||
|
||||
@@ -58,11 +58,14 @@ return [
|
||||
],
|
||||
|
||||
'nextcloud' => [
|
||||
'driver' => 'nextcloud',
|
||||
'driver' => 'webdav',
|
||||
'baseUri' => env('NEXT_CLOUD_URL'),
|
||||
'userName' => env('NEXT_CLOUD_USERNAME'),
|
||||
'password' => env('NEXT_CLOUD_PASSWORD'),
|
||||
'directory' => '',
|
||||
'pathPrefix' => env("NEXT_CLOUD_PATHPREFIX", ''),
|
||||
'options' => [
|
||||
'verify' => false,
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
@@ -7,6 +7,7 @@ use Database\Seeds\RolePermissionSeeder;
|
||||
use Database\Seeds\MenuSeeder;
|
||||
use Database\Seeds\RayonSeeder;
|
||||
use Database\Seeds\RolePermissionSeeder2;
|
||||
use Database\Seeds\RolePermissionSeeder3;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
@@ -17,11 +18,12 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->call(UserSeeder::class);
|
||||
$this->call(AdminSeeder::class);
|
||||
$this->call(RolePermissionSeeder::class);
|
||||
$this->call(MenuSeeder::class);
|
||||
$this->call(RayonSeeder::class);
|
||||
$this->call(RolePermissionSeeder2::class);
|
||||
// $this->call(UserSeeder::class);
|
||||
// $this->call(AdminSeeder::class);
|
||||
// $this->call(RolePermissionSeeder::class);
|
||||
// $this->call(MenuSeeder::class);
|
||||
// $this->call(RayonSeeder::class);
|
||||
// $this->call(RolePermissionSeeder2::class);
|
||||
$this->call(RolePermissionSeeder3::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeds;
|
||||
|
||||
use App\Models\Admin;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
|
||||
/**
|
||||
* Class RolePermissionSeeder.
|
||||
*
|
||||
* @see https://spatie.be/docs/laravel-permission/v5/basic-usage/multiple-guards
|
||||
*
|
||||
* @package App\Database\Seeds
|
||||
*/
|
||||
class RolePermissionSeeder3 extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
/**
|
||||
* Enable these options if you need same role and other permission for User Model
|
||||
* Else, please follow the below steps for admin guard
|
||||
*/
|
||||
$permissions = [
|
||||
[
|
||||
'group_name' => 'forms.country',
|
||||
'permissions' => [
|
||||
'forms.country.view',
|
||||
'forms.country.create',
|
||||
'forms.country.edit',
|
||||
'forms.country.delete',
|
||||
'forms.country.approve',
|
||||
]
|
||||
],
|
||||
[
|
||||
'group_name' => 'forms.vehicle',
|
||||
'permissions' => [
|
||||
'forms.vehicle.view',
|
||||
'forms.vehicle.create',
|
||||
'forms.vehicle.edit',
|
||||
'forms.vehicle.delete',
|
||||
'forms.vehicle.approve',
|
||||
]
|
||||
],
|
||||
[
|
||||
'group_name' => 'forms.entertainment',
|
||||
'permissions' => [
|
||||
'forms.entertainment.view',
|
||||
'forms.entertainment.create',
|
||||
'forms.entertainment.edit',
|
||||
'forms.entertainment.delete',
|
||||
'forms.entertainment.approve',
|
||||
]
|
||||
],
|
||||
[
|
||||
'group_name' => 'forms.meeting',
|
||||
'permissions' => [
|
||||
'forms.meeting.view',
|
||||
'forms.meeting.create',
|
||||
'forms.meeting.edit',
|
||||
'forms.meeting.delete',
|
||||
'forms.meeting.approve',
|
||||
]
|
||||
],
|
||||
[
|
||||
'group_name' => 'forms.other',
|
||||
'permissions' => [
|
||||
'forms.other.view',
|
||||
'forms.other.create',
|
||||
'forms.other.edit',
|
||||
'forms.other.delete',
|
||||
'forms.other.approve',
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
// Do same for the admin guard for tutorial purposes.
|
||||
$admin = Admin::where('username', 'superadmin')->first();
|
||||
$roleSuperAdmin = $this->maybeCreateSuperAdminRole($admin);
|
||||
|
||||
// Create and Assign Permissions
|
||||
for ($i = 0; $i < count($permissions); $i++) {
|
||||
$permissionGroup = $permissions[$i]['group_name'];
|
||||
for ($j = 0; $j < count($permissions[$i]['permissions']); $j++) {
|
||||
$permissionExist = Permission::where('name', $permissions[$i]['permissions'][$j])->first();
|
||||
if (is_null($permissionExist)) {
|
||||
$permission = Permission::create(
|
||||
[
|
||||
'name' => $permissions[$i]['permissions'][$j],
|
||||
'group_name' => $permissionGroup,
|
||||
'guard_name' => 'admin'
|
||||
]
|
||||
);
|
||||
$roleSuperAdmin->givePermissionTo($permission);
|
||||
$permission->assignRole($roleSuperAdmin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Assign super admin role permission to superadmin user
|
||||
if ($admin) {
|
||||
$admin->assignRole($roleSuperAdmin);
|
||||
}
|
||||
}
|
||||
|
||||
private function maybeCreateSuperAdminRole($admin): Role
|
||||
{
|
||||
if (is_null($admin)) {
|
||||
$roleSuperAdmin = Role::create(['name' => 'superadmin', 'guard_name' => 'admin']);
|
||||
} else {
|
||||
$roleSuperAdmin = Role::where('name', 'superadmin')->where('guard_name', 'admin')->first();
|
||||
}
|
||||
|
||||
if (is_null($roleSuperAdmin)) {
|
||||
$roleSuperAdmin = Role::create(['name' => 'superadmin', 'guard_name' => 'admin']);
|
||||
}
|
||||
|
||||
return $roleSuperAdmin;
|
||||
}
|
||||
}
|
||||
@@ -24,12 +24,14 @@
|
||||
<div class="container-fluid">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body">
|
||||
<form>
|
||||
<form method="POST" action="{{ route('forms.up-country.store') }}" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@include('backend.layouts.partials.messages')
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Pilih Rayon</label>
|
||||
<select class="form-control form-control-md">
|
||||
<select class="form-control form-control-md" name="rayon_id" required>
|
||||
<option value="">Pilih Rayon</option>
|
||||
@foreach ($rayons as $rayon)
|
||||
<option value="{{ $rayon->id }}">{{ $rayon->name }}</option>
|
||||
@@ -38,50 +40,50 @@
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tanggal</label>
|
||||
<input type="date" class="form-control">
|
||||
<input type="date" class="form-control" name="tanggal" required value="{{ old('tanggal') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tujuan</label>
|
||||
<input type="text" class="form-control">
|
||||
<input type="text" class="form-control" name="tujuan" required value="{{ old('tujuan') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Jarak</label>
|
||||
<input type="number" class="form-control">
|
||||
<input type="number" class="form-control" name="jarak" required value="{{ old('jarak') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Allowance</label>
|
||||
<input type="number" class="form-control">
|
||||
<input type="number" class="form-control" name="allowance" id="allowance" required value="{{ old('allowance') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Transport Dalam Kota</label>
|
||||
<input type="number" class="form-control">
|
||||
<input type="number" class="form-control" name="transport_dalkot" id="transport_dalkot" required value="{{ old('transport_dalkot') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Transport Antar Kota</label>
|
||||
<input type="number" class="form-control">
|
||||
<input type="number" class="form-control" name="transport_ankot" id="transport_ankot" required value="{{ old('transport_ankot') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Hotel</label>
|
||||
<input type="number" class="form-control">
|
||||
<input type="number" class="form-control" name="hotel" id="hotel" required value="{{ old('hotel') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Total</label>
|
||||
<input type="number" class="form-control">
|
||||
<input type="number" class="form-control" name="total" id="total" required value="{{ old('total') }}" readonly>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 1</label>
|
||||
<input type="file" class="form-control">
|
||||
<input type="file" class="form-control" name="bukti1" value="{{ old('bukti1') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 2</label>
|
||||
<input type="file" class="form-control">
|
||||
<input type="file" class="form-control" name="bukti2" value="{{ old('bukti2') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 3</label>
|
||||
<input type="file" class="form-control">
|
||||
<input type="file" class="form-control" name="bukti3" value="{{ old('bukti3') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -92,4 +94,30 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
const allowance = document.getElementById('allowance');
|
||||
const transportDalkot = document.getElementById('transport_dalkot');
|
||||
const transportAnkot = document.getElementById('transport_ankot');
|
||||
const hotel = document.getElementById('hotel');
|
||||
const total = document.getElementById('total');
|
||||
|
||||
// Function to calculate total
|
||||
function calculateTotal() {
|
||||
const allowanceValue = parseInt(allowance.value) || 0;
|
||||
const transportDalkotValue = parseInt(transportDalkot.value) || 0;
|
||||
const transportAnkotValue = parseInt(transportAnkot.value) || 0;
|
||||
const hotelValue = parseInt(hotel.value) || 0;
|
||||
|
||||
total.value = allowanceValue + transportDalkotValue + transportAnkotValue + hotelValue;
|
||||
}
|
||||
|
||||
// Attach event listeners
|
||||
[allowance, transportDalkot, transportAnkot, hotel].forEach(input => {
|
||||
input.addEventListener('input', calculateTotal);
|
||||
});
|
||||
|
||||
// Initial calculation on page load
|
||||
calculateTotal();
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
@@ -24,72 +24,101 @@
|
||||
<div class="container-fluid">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body">
|
||||
<form>
|
||||
<form method="POST" action="{{ route('forms.up-country.update', $form->id) }}" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
@include('backend.layouts.partials.messages')
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Pilih Rayon</label>
|
||||
<select class="form-control form-control-md">
|
||||
<select class="form-control form-control-md" name="rayon_id" required>
|
||||
<option value="">Pilih Rayon</option>
|
||||
@foreach ($rayons as $rayon)
|
||||
<option value="{{ $rayon->id }}">{{ $rayon->name }}</option>
|
||||
<option value="{{ $rayon->id }}" {{ $form->rayon_id == $rayon->id ? 'selected' : '' }}>{{ $rayon->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tanggal</label>
|
||||
<input type="date" class="form-control">
|
||||
<input type="date" class="form-control" name="tanggal" required value="{{ $form->tanggal }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tujuan</label>
|
||||
<input type="text" class="form-control">
|
||||
<input type="text" class="form-control" name="tujuan" required value="{{ $form->tujuan }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Jarak</label>
|
||||
<input type="number" class="form-control">
|
||||
<input type="number" class="form-control" name="jarak" required value="{{ $form->jarak }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Allowance</label>
|
||||
<input type="number" class="form-control">
|
||||
<input type="number" class="form-control" name="allowance" id="allowance" required value="{{ $form->allowance }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Transport Dalam Kota</label>
|
||||
<input type="number" class="form-control">
|
||||
<input type="number" class="form-control" name="transport_dalkot" id="transport_dalkot" required value="{{ $form->transport_dalkot }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Transport Antar Kota</label>
|
||||
<input type="number" class="form-control">
|
||||
<input type="number" class="form-control" name="transport_ankot" id="transport_ankot" required value="{{ $form->transport_ankot }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Hotel</label>
|
||||
<input type="number" class="form-control">
|
||||
<input type="number" class="form-control" name="hotel" id="hotel" required value="{{ $form->hotel }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Total</label>
|
||||
<input type="number" class="form-control">
|
||||
<input type="number" class="form-control" name="total" id="total" required value="{{ $form->total }}" readonly>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 1</label>
|
||||
<input type="file" class="form-control">
|
||||
<input type="file" class="form-control" name="bukti1" value="{{ old('bukti1') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 2</label>
|
||||
<input type="file" class="form-control">
|
||||
<input type="file" class="form-control" name="bukti2" value="{{ old('bukti2') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 3</label>
|
||||
<input type="file" class="form-control">
|
||||
<input type="file" class="form-control" name="bukti3" value="{{ old('bukti3') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary ml-2">Submit</button>
|
||||
<button type="submit" class="btn btn-primary ml-2">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
const allowance = document.getElementById('allowance');
|
||||
const transportDalkot = document.getElementById('transport_dalkot');
|
||||
const transportAnkot = document.getElementById('transport_ankot');
|
||||
const hotel = document.getElementById('hotel');
|
||||
const total = document.getElementById('total');
|
||||
|
||||
// Function to calculate total
|
||||
function calculateTotal() {
|
||||
const allowanceValue = parseInt(allowance.value) || 0;
|
||||
const transportDalkotValue = parseInt(transportDalkot.value) || 0;
|
||||
const transportAnkotValue = parseInt(transportAnkot.value) || 0;
|
||||
const hotelValue = parseInt(hotel.value) || 0;
|
||||
|
||||
total.value = allowanceValue + transportDalkotValue + transportAnkotValue + hotelValue;
|
||||
}
|
||||
|
||||
// Attach event listeners
|
||||
[allowance, transportDalkot, transportAnkot, hotel].forEach(input => {
|
||||
input.addEventListener('input', calculateTotal);
|
||||
});
|
||||
|
||||
// Initial calculation on page load
|
||||
calculateTotal();
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
@@ -26,9 +26,11 @@
|
||||
<div class="card-body">
|
||||
<h4 class="header-title float-left">List Data Forms Up Country Anda</h4>
|
||||
<p class="float-right mb-2">
|
||||
<a class="btn btn-primary text-white" href="">
|
||||
Add New Expense Up Country
|
||||
</a>
|
||||
@if (auth()->user()->can('forms.country.create'))
|
||||
<a class="btn btn-primary text-white" href="{{ route('forms.up-country.create') }}">
|
||||
Add New Expense Up Country
|
||||
</a>
|
||||
@endif
|
||||
</p>
|
||||
<div class="clearfix"></div>
|
||||
<div class="dataTables_wrapper dt-bootstrap4 mt-2">
|
||||
@@ -45,41 +47,58 @@
|
||||
<th>Tujuan</th>
|
||||
<th>Jarak</th>
|
||||
<th>Allowance</th>
|
||||
<th>Transport Dalkot</th>
|
||||
<th>Transport Ankot</th>
|
||||
<th>Hotel</th>
|
||||
<th>Total</th>
|
||||
<th>Bukti 1</th>
|
||||
<th>Bukti 2</th>
|
||||
<th>Bukti 3</th>
|
||||
<th>Account Number</th>
|
||||
<th>Status</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>John Doe</td>
|
||||
<td>Rayon 1</td>
|
||||
<td>2021-09-01</td>
|
||||
<td>Surabaya</td>
|
||||
<td>100</td>
|
||||
<td>100000</td>
|
||||
<td>10000</td>
|
||||
<td>5000</td>
|
||||
<td>50000</td>
|
||||
<td>file1.jpg</td>
|
||||
<td>file2.jpg</td>
|
||||
<td>file3.jpg</td>
|
||||
<td>1234567890</td>
|
||||
<td>
|
||||
<a href="" class="btn btn-warning btn-sm">
|
||||
<i class="fas fa-edit text-white"></i>
|
||||
</a>
|
||||
<a href="" class="btn btn-danger btn-sm">
|
||||
<i class="fas fa-trash"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@foreach ($forms as $item)
|
||||
<tr>
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ $item->user->name }}</td>
|
||||
<td>{{ $item->rayon->code }}</td>
|
||||
<td>{{ $item->tanggal }}</td>
|
||||
<td>{{ $item->tujuan }}</td>
|
||||
<td>{{ $item->jarak }} km</td>
|
||||
<td>{{ number_format($item->allowance, 0, ',', '.') }}</td>
|
||||
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
|
||||
<td>{{ $item->bukti1 }}</td>
|
||||
<td>{{ $item->bukti2 }}</td>
|
||||
<td>{{ $item->bukti3 }}</td>
|
||||
<td>{{ $item->account_number }}</td>
|
||||
<td>
|
||||
@if ($item->status == 'On Progress')
|
||||
<span class="badge badge-warning text-white">{{ $item->status }}</span>
|
||||
@elseif ($item->status == 'Completed')
|
||||
<span class="badge badge-success text-white">{{ $item->status }}</span>
|
||||
@else
|
||||
<span class="badge badge-danger text-white">{{ $item->status }}</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if (auth()->user()->can('forms.country.edit'))
|
||||
<a href="{{ route('forms.up-country.edit', $item->id) }}" class="btn btn-warning btn-sm">
|
||||
<i class="fas fa-edit text-white"></i>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if (auth()->user()->can('forms.country.delete'))
|
||||
<form action="{{ route('forms.up-country.destroy', $item->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-danger btn-sm">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title')
|
||||
Dashboard
|
||||
@endsection
|
||||
|
||||
@section('admin-content')
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1>Tambahkan Expense Vehicle Running Cost Baru</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ route('forms.vehicle.store') }}" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@include('backend.layouts.partials.messages')
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tanggal</label>
|
||||
<input type="datetime-local" class="form-control" name="tanggal" required value="{{ old('tanggal') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Liter Bensin</label>
|
||||
<input type="text" class="form-control" name="liter" required value="{{ old('liter') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Harga Bensin</label>
|
||||
<input type="number" class="form-control" name="harga" required value="{{ old('harga') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Jarak</label>
|
||||
<input type="number" class="form-control" name="jarak" id="jarak" required value="{{ old('jarak') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Keterangan</label>
|
||||
<textarea class="form-control" name="keterangan" id="keterangan" required>
|
||||
{{ old('keterangan') }}
|
||||
</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tipe Bensin</label>
|
||||
<select class="form-control" name="tipe_bensin" required value="{{ old('tipe_bensin') }}">
|
||||
<option value="pertamax">Pertamax</option>
|
||||
<option value="pertalite">Pertalite</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Nomor Polisi</label>
|
||||
<input type="text" class="form-control" name="nopol" id="nopol" required value="{{ old('nopol') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 1</label>
|
||||
<input type="file" class="form-control" name="bukti1" value="{{ old('bukti1') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 2</label>
|
||||
<input type="file" class="form-control" name="bukti2" value="{{ old('bukti2') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 3</label>
|
||||
<input type="file" class="form-control" name="bukti3" value="{{ old('bukti3') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary ml-2">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
@@ -0,0 +1,88 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title')
|
||||
Dashboard
|
||||
@endsection
|
||||
|
||||
@section('admin-content')
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1>Edit Expense Vehicle Running Cost</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ route('forms.vehicle.update', $form->id) }}" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
@include('backend.layouts.partials.messages')
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tanggal</label>
|
||||
<input type="datetime-local" class="form-control" name="tanggal" required value="{{ $form->tanggal }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Liter Bensin</label>
|
||||
<input type="text" class="form-control" name="liter" required value="{{ $form->liter }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Harga Bensin</label>
|
||||
<input type="number" class="form-control" name="harga" required value="{{ $form->harga }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Jarak</label>
|
||||
<input type="number" class="form-control" name="jarak" id="jarak" required value="{{ $form->jarak }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Keterangan</label>
|
||||
<textarea class="form-control" name="keterangan" id="keterangan" required>{{ $form->keterangan }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tipe Bensin</label>
|
||||
<select class="form-control" name="tipe_bensin" required>
|
||||
<option value="pertamax" {{ $form->tipe_bensin == 'pertamax' ? 'selected' : '' }}>Pertamax</option>
|
||||
<option value="pertalite" {{ $form->tipe_bensin == 'pertalite' ? 'selected' : '' }}>Pertalite</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Nomor Polisi</label>
|
||||
<input type="text" class="form-control" name="nopol" id="nopol" required value="{{ $form->nopol }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 1</label>
|
||||
<input type="file" class="form-control" name="bukti1" value="{{ $form->bukti1 }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 2</label>
|
||||
<input type="file" class="form-control" name="bukti2" value="{{ $form->bukti2 }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 3</label>
|
||||
<input type="file" class="form-control" name="bukti3" value="{{ $form->bukti3 }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary ml-2">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
@@ -0,0 +1,109 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title')
|
||||
Dashboard
|
||||
@endsection
|
||||
|
||||
@section('admin-content')
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1>Forms Vehicle Running Cost</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title float-left">List Data Forms Vehicle Running Cost Anda</h4>
|
||||
<p class="float-right mb-2">
|
||||
@if (auth()->user()->can('forms.vehicle.create'))
|
||||
<a class="btn btn-primary text-white" href="{{ route('forms.vehicle.create') }}">
|
||||
Add New Expense Vehicle Running Cost
|
||||
</a>
|
||||
@endif
|
||||
</p>
|
||||
<div class="clearfix"></div>
|
||||
<div class="dataTables_wrapper dt-bootstrap4 mt-2">
|
||||
@include('backend.layouts.partials.messages')
|
||||
<table id="dataTable"
|
||||
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
|
||||
style="width:100%">
|
||||
<thead class="bg-light text-capitalize">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Nama</th>
|
||||
<th>Tanggal</th>
|
||||
<th>Liter</th>
|
||||
<th>Harga</th>
|
||||
<th>Jarak</th>
|
||||
<th>Tipe Bensin</th>
|
||||
<th>Nomor Polisi</th>
|
||||
<th>Bukti 1</th>
|
||||
<th>Bukti 2</th>
|
||||
<th>Bukti 3</th>
|
||||
<th>Account Number</th>
|
||||
<th>Status</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($forms as $item)
|
||||
<tr>
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ $item->user->name }}</td>
|
||||
<td>{{ \Carbon\Carbon::parse($item->tanggal)->locale('id')->isoFormat('dddd, D MMMM Y HH:mm:ss') }}</td>
|
||||
<td>{{ $item->liter }}</td>
|
||||
<td>{{ $item->harga }}</td>
|
||||
<td>{{ $item->jarak }}</td>
|
||||
<td>{{ $item->tipe_bensin }}</td>
|
||||
<td>{{ $item->nopol }}</td>
|
||||
<td>{{ $item->bukti1 }}</td>
|
||||
<td>{{ $item->bukti2 }}</td>
|
||||
<td>{{ $item->bukti3 }}</td>
|
||||
<td>{{ $item->account_number }}</td>
|
||||
<td>
|
||||
@if ($item->status == 'On Progress')
|
||||
<span class="badge badge-warning text-white">{{ $item->status }}</span>
|
||||
@elseif ($item->status == 'Completed')
|
||||
<span class="badge badge-success text-white">{{ $item->status }}</span>
|
||||
@else
|
||||
<span class="badge badge-danger text-white">{{ $item->status }}</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if (auth()->user()->can('forms.vehicle.edit'))
|
||||
<a href="{{ route('forms.vehicle.edit', $item->id) }}" class="btn btn-warning btn-sm">
|
||||
<i class="fas fa-edit text-white"></i>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if (auth()->user()->can('forms.vehicle.delete'))
|
||||
<form action="{{ route('forms.vehicle.destroy', $item->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-danger btn-sm">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
@@ -25,7 +25,7 @@
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12 mt-5">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title float-left">{{ $pageInfo['sub_title'] }}</h4>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<div class="main-content-inner">
|
||||
<div class="row">
|
||||
<!-- data table start -->
|
||||
<div class="col-12 mt-5">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title float-left">Users List</h4>
|
||||
|
||||
@@ -12,6 +12,8 @@ use App\Http\Controllers\Forms\FormUpCountryController;
|
||||
use App\Http\Controllers\Master\RayonController;
|
||||
use App\Http\Controllers\Master\CostCentreController;
|
||||
use App\Http\Controllers\Master\CategoryController;
|
||||
use App\Http\Controllers\Forms\FormVehicleController;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
Auth::routes();
|
||||
|
||||
@@ -70,9 +72,30 @@ Route::middleware(['auth:admin', 'menu'])->group(function () {
|
||||
Route::get('/up-country/edit/{id}', [FormUpCountryController::class, 'edit'])->name('forms.up-country.edit');
|
||||
Route::put('/up-country/update/{id}', [FormUpCountryController::class, 'update'])->name('forms.up-country.update');
|
||||
Route::delete('/up-country/destroy/{id}', [FormUpCountryController::class, 'destroy'])->name('forms.up-country.destroy');
|
||||
|
||||
// Vehicle Running Cost
|
||||
Route::get('/vehicle-running-cost', [FormVehicleController::class, 'index'])->name('forms.vehicle');
|
||||
Route::get('/vehicle-running-cost/create', [FormVehicleController::class, 'create'])->name('forms.vehicle.create');
|
||||
Route::post('/vehicle-running-cost/store', [FormVehicleController::class, 'store'])->name('forms.vehicle.store');
|
||||
Route::get('/vehicle-running-cost/edit/{id}', [FormVehicleController::class, 'edit'])->name('forms.vehicle.edit');
|
||||
Route::put('/vehicle-running-cost/update/{id}', [FormVehicleController::class, 'update'])->name('forms.vehicle.update');
|
||||
Route::delete('/vehicle-running-cost/destroy/{id}', [FormVehicleController::class, 'destroy'])->name('forms.vehicle.destroy');
|
||||
});
|
||||
|
||||
//Menu Role
|
||||
Route::get('/auth/menu-tree/{id}', [MenuRoleController::class, 'index'])->name('auth.menurole.index');
|
||||
Route::post('/auth/menu-tree/submit', [MenuRoleController::class, 'saveMenu'])->name('auth.menurole.submit');
|
||||
});
|
||||
|
||||
Route::get('/test-nextcloud', function () {
|
||||
$disk = Storage::disk('nextcloud');
|
||||
$folderPath = 'test-directory';
|
||||
|
||||
// Check if directory exists
|
||||
if (!$disk->exists($folderPath)) {
|
||||
$disk->makeDirectory($folderPath);
|
||||
return "Directory created: $folderPath";
|
||||
}
|
||||
|
||||
return "Directory already exists: $folderPath";
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user