Merge branch 'branch-jagad' into 'main'

Branch jagad

See merge request fiqhpratama1/xpendify!2
This commit is contained in:
FIQH PRATAMA
2024-12-19 06:19:13 +00:00
32 changed files with 2408 additions and 85 deletions
+2 -1
View File
@@ -68,6 +68,7 @@ AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}" VITE_APP_NAME="${APP_NAME}"
NEXT_CLOUD_URL=https://mkt.tunggal-pharma.com/ NEXT_CLOUD_URL=https://mkt.tunggal-pharma.com
NEXT_CLOUD_USERNAME=user_dev NEXT_CLOUD_USERNAME=user_dev
NEXT_CLOUD_PASSWORD=userdev12345 NEXT_CLOUD_PASSWORD=userdev12345
NEXT_CLOUD_PATHPREFIX=""
+80 -7
View File
@@ -4,6 +4,7 @@ namespace App\Helpers;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use Illuminate\Support\Str;
class NextCloudHelper class NextCloudHelper
{ {
@@ -19,17 +20,78 @@ class NextCloudHelper
public static function createFolder($baseUrl, $username, $password, $folderPath) public static function createFolder($baseUrl, $username, $password, $folderPath)
{ {
$client = new Client(); $client = new Client();
$url = rtrim($baseUrl, '/') . "/remote.php/dav/files/{$username}/" . ltrim($folderPath, '/'); $folders = explode('/', ltrim($folderPath, '/')); // Split the folder path into an array
$currentPath = ''; // Initialize an empty string to build the path progressively
foreach ($folders as $folder) {
$currentPath .= '/' . $folder; // Add the current folder to the path
// Build the URL to create the folder
$url = rtrim($baseUrl, '/') . "/mktia/remote.php/dav/files/{$username}" . $currentPath;
try {
// Attempt to create the current folder
$response = $client->request('MKCOL', $url, [
'auth' => [$username, $password],
'verify' => false // Disable SSL verification (only for testing purposes)
]);
// If folder creation is successful, proceed to the next folder
if ($response->getStatusCode() === 201) {
echo "Folder '$currentPath' created successfully.\n";
}
} catch (RequestException $e) {
// Handle errors, such as folder already existing
if ($e->getCode() === 409) {
echo "Folder '$currentPath' already exists.\n";
} else {
// For other errors
echo "Failed to create folder '$currentPath': " . $e->getMessage() . "\n";
}
}
}
return [
'success' => true,
'status' => 200,
'message' => 'All folders processed.'
];
}
public static function uploadFile($folderPath, $fileObject, $fileName)
{
$baseUrl = env('NEXT_CLOUD_URL');
$username = env('NEXT_CLOUD_USERNAME');
$password= env('NEXT_CLOUD_PASSWORD');
// Ensure the folder exists (or create it)
$folderResponse = self::createFolder($baseUrl, $username, $password, $folderPath);
// Check if folder creation was successful or if it already exists
if (!$folderResponse['success']) {
return [
'success' => false,
'status' => $folderResponse['status'],
'message' => 'Failed to create folder: ' . $folderResponse['message']
];
}
$client = new Client();
$url = rtrim($baseUrl, '/') . "/mktia/remote.php/dav/files/{$username}/" . ltrim($folderPath, '/') . '/' . $fileName;
try { try {
$response = $client->request('MKCOL', $url, [ // If fileObject is a stream, we can use it directly
'auth' => [$username, $password] // If it's raw content, ensure it's being properly passed
$response = $client->request('PUT', $url, [
'auth' => [$username, $password],
'body' => $fileObject, // File content or stream
'verify' => false // Disable SSL verification (only for testing purposes)
]); ]);
return [ return [
'success' => true, 'success' => true,
'status' => $response->getStatusCode(), 'status' => $response->getStatusCode(),
'message' => 'Folder created successfully.' 'message' => 'File uploaded successfully.'
]; ];
} catch (RequestException $e) { } catch (RequestException $e) {
return [ return [
@@ -39,8 +101,19 @@ class NextCloudHelper
]; ];
} }
} }
public static function getFileUrl($filePath)
{
$baseUrl = env('NEXT_CLOUD_URL');
$username = env('NEXT_CLOUD_USERNAME');
// Build the user-specific WebDAV file URL
$relativePath = "/mktia/remote.php/dav/files/{$username}/" . ltrim($filePath, '/');
// Return the full accessible URL
return rtrim($baseUrl, '/') . '/' . $relativePath;
}
/** /**
* Create a user in Nextcloud. * Create a user in Nextcloud.
@@ -0,0 +1,229 @@
<?php
namespace App\Http\Controllers\Forms;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\FormEntertaimentPresentation;
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;
use App\Helpers\NextCloudHelper;
use Illuminate\Support\Str;
class FormEntertainmentPresentationController extends Controller
{
public function index()
{
$this->checkAuthorization(auth()->user(), ['forms.entertainment.view']);
$forms = FormEntertaimentPresentation::where('user_id', auth()->user()->id)->get();
return view('backend.pages.forms.entertainment.index', [
'forms' => $forms
]);
}
public function create()
{
$this->checkAuthorization(auth()->user(), ['forms.entertainment.create']);
return view('backend.pages.forms.entertainment.create');
}
public function store(Request $request)
{
$this->checkAuthorization(auth()->user(), ['forms.entertainment.create']);
$request->validate([
'tanggal' => 'required',
'jenis' => 'required|in:entertainment,presentation,sponsorship',
'keterangan' => 'required',
'total' => 'required',
'name' => 'required',
'alamat' => 'required',
'nik_or_npwp' => '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', 'Entertainment & Presentation')->first();
$filePaths = [];
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/entertainment';
if ($request->hasFile('bukti1')) {
$bukti1 = $request->file('bukti1');
$filename = Str::uuid() . '.' . $bukti1->extension();
$filePaths['bukti1'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti1->getContent(),
$filename
);
}
if ($request->hasFile('bukti2')) {
$bukti2 = $request->file('bukti2');
$filename = Str::uuid() . '.' . $bukti2->extension();
$filePaths['bukti2'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti2->getContent(),
$filename
);
}
if ($request->hasFile('bukti3')) {
$bukti3 = $request->file('bukti3');
$filename = Str::uuid() . '.' . $bukti3->extension();
$filePaths['bukti3'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti3->getContent(),
$filename
);
}
// Generate sequence number and expense number
$sequence_number = FormEntertaimentPresentation::withTrashed()->where('expense_number', 'like', $region->code . '-' . $cabang->code . '-ETY-' . date('ym') . '%')->count() + 1;
$formatted_sequence_number = str_pad($sequence_number, 4, '0', STR_PAD_LEFT);
$expense_number = $region->code . '-' . $cabang->code . '-ETY-' . date('ym') . $formatted_sequence_number;
// Save the form data
FormEntertaimentPresentation::create([
'expense_number' => $expense_number,
'user_id' => auth()->user()->id,
'tanggal' => $request->tanggal,
'jenis' => $request->jenis,
'keterangan' => $request->keterangan,
'total' => $request->total,
'name' => $request->name,
'alamat' => $request->alamat,
'nik_or_npwp' => $request->nik_or_npwp,
'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.entertainment');
}
public function edit($id)
{
$this->checkAuthorization(auth()->user(), ['forms.entertainment.edit']);
$form = FormEntertaimentPresentation::findOrfail($id);
return view('backend.pages.forms.entertainment.edit', [
'form' => $form
]);
}
public function update(Request $request, $id)
{
$this->checkAuthorization(auth()->user(), ['forms.entertainment.edit']);
$request->validate([
'tanggal' => 'required',
'jenis' => 'required|in:entertainment,presentation,sponsorship',
'keterangan' => 'required',
'total' => 'required',
'name' => 'required',
'alamat' => 'required',
'nik_or_npwp' => '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', 'Entertainment & Presentation')->first();
$filePaths = [];
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/entertainment';
if ($request->hasFile('bukti1')) {
$bukti1 = $request->file('bukti1');
$filename = Str::uuid() . '.' . $bukti1->extension();
$filePaths['bukti1'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti1->getContent(),
$filename
);
}
if ($request->hasFile('bukti2')) {
$bukti2 = $request->file('bukti2');
$filename = Str::uuid() . '.' . $bukti2->extension();
$filePaths['bukti2'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti2->getContent(),
$filename
);
}
if ($request->hasFile('bukti3')) {
$bukti3 = $request->file('bukti3');
$filename = Str::uuid() . '.' . $bukti3->extension();
$filePaths['bukti3'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti3->getContent(),
$filename
);
}
// Save the form data
$form = FormEntertaimentPresentation::findOrfail($id);
$form->update([
'tanggal' => $request->tanggal,
'jenis' => $request->jenis,
'keterangan' => $request->keterangan,
'total' => $request->total,
'name' => $request->name,
'alamat' => $request->alamat,
'nik_or_npwp' => $request->nik_or_npwp,
'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 updated.');
return redirect()->route('forms.entertainment');
}
public function destroy($id)
{
$this->checkAuthorization(auth()->user(), ['forms.entertainment.delete']);
$form = FormEntertaimentPresentation::findOrfail($id);
$form->delete();
session()->flash('success', 'Form has been deleted.');
return redirect()->route('forms.entertainment');
}
}
@@ -0,0 +1,217 @@
<?php
namespace App\Http\Controllers\Forms;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\FormMeetingSeminar;
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;
use App\Helpers\NextCloudHelper;
use Illuminate\Support\Str;
class FormMeetingSeminarController extends Controller
{
public function index()
{
$this->checkAuthorization(auth()->user(), ['forms.meeting.view']);
$forms = FormMeetingSeminar::where('user_id', auth()->user()->id)->get();
return view('backend.pages.forms.meeting.index', [
'forms' => $forms
]);
}
public function create()
{
$this->checkAuthorization(auth()->user(), ['forms.meeting.create']);
return view('backend.pages.forms.meeting.create');
}
public function store(Request $request)
{
$this->checkAuthorization(auth()->user(), ['forms.meeting.create']);
$request->validate([
'allowance' => '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', 'Meeting & Seminar')->first();
$filePaths = [];
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/meeting';
if ($request->hasFile('bukti1')) {
$bukti1 = $request->file('bukti1');
$filename = Str::uuid() . '.' . $bukti1->extension();
$filePaths['bukti1'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti1->getContent(),
$filename
);
}
if ($request->hasFile('bukti2')) {
$bukti2 = $request->file('bukti2');
$filename = Str::uuid() . '.' . $bukti2->extension();
$filePaths['bukti2'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti2->getContent(),
$filename
);
}
if ($request->hasFile('bukti3')) {
$bukti3 = $request->file('bukti3');
$filename = Str::uuid() . '.' . $bukti3->extension();
$filePaths['bukti3'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti3->getContent(),
$filename
);
}
// Generate sequence number and expense number
$sequence_number = FormMeetingSeminar::withTrashed()->where('expense_number', 'like', $region->code . '-' . $cabang->code . '-MTG-' . date('ym') . '%')->count() + 1;
$formatted_sequence_number = str_pad($sequence_number, 4, '0', STR_PAD_LEFT);
$expense_number = $region->code . '-' . $cabang->code . '-MTG-' . date('ym') . $formatted_sequence_number;
// Save the form data
FormMeetingSeminar::create([
'expense_number' => $expense_number,
'user_id' => auth()->user()->id,
'allowance' => $request->allowance,
'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.meeting');
}
public function edit($id)
{
$this->checkAuthorization(auth()->user(), ['forms.meeting.edit']);
$form = FormMeetingSeminar::findOrfail($id);
return view('backend.pages.forms.meeting.edit', [
'form' => $form
]);
}
public function update(Request $request, $id)
{
$this->checkAuthorization(auth()->user(), ['forms.meeting.edit']);
$request->validate([
'allowance' => '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', 'Meeting & Seminar')->first();
$filePaths = [];
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/meeting';
if ($request->hasFile('bukti1')) {
$bukti1 = $request->file('bukti1');
$filename = Str::uuid() . '.' . $bukti1->extension();
$filePaths['bukti1'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti1->getContent(),
$filename
);
}
if ($request->hasFile('bukti2')) {
$bukti2 = $request->file('bukti2');
$filename = Str::uuid() . '.' . $bukti2->extension();
$filePaths['bukti2'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti2->getContent(),
$filename
);
}
if ($request->hasFile('bukti3')) {
$bukti3 = $request->file('bukti3');
$filename = Str::uuid() . '.' . $bukti3->extension();
$filePaths['bukti3'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti3->getContent(),
$filename
);
}
// Save the form data
$form = FormMeetingSeminar::findOrfail($id);
$form->update([
'allowance' => $request->allowance,
'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.meeting');
}
public function destroy($id)
{
$this->checkAuthorization(auth()->user(), ['forms.meeting.delete']);
$form = FormMeetingSeminar::findOrfail($id);
$form->delete();
session()->flash('success', 'Form has been deleted.');
return redirect()->route('forms.meeting');
}
}
@@ -6,40 +6,235 @@ use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\FormUpCountry; use App\Models\FormUpCountry;
use App\Models\Rayon; 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;
use App\Helpers\NextCloudHelper;
use Illuminate\Support\Str;
class FormUpCountryController extends Controller class FormUpCountryController extends Controller
{ {
public function index() 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() public function create()
{ {
$this->checkAuthorization(auth()->user(), ['forms.country.create']);
return view('backend.pages.forms.upcountry.create', [ return view('backend.pages.forms.upcountry.create', [
'rayons' => Rayon::all() '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';
if ($request->hasFile('bukti1')) {
$bukti1 = $request->file('bukti1');
$filename = Str::uuid() . '.' . $bukti1->extension();
$filePaths['bukti1'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti1->getContent(),
$filename
);
}
if ($request->hasFile('bukti2')) {
$bukti2 = $request->file('bukti2');
$filename = Str::uuid() . '.' . $bukti2->extension();
$filePaths['bukti2'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti2->getContent(),
$filename
);
}
if ($request->hasFile('bukti3')) {
$bukti3 = $request->file('bukti3');
$filename = Str::uuid() . '.' . $bukti3->extension();
$filePaths['bukti3'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti3->getContent(),
$filename
);
}
// 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', [ 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';
if ($request->hasFile('bukti1')) {
$bukti1 = $request->file('bukti1');
$filename = Str::uuid() . '.' . $bukti1->extension();
$filePaths['bukti1'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti1->getContent(),
$filename
);
}
if ($request->hasFile('bukti2')) {
$bukti2 = $request->file('bukti2');
$filename = Str::uuid() . '.' . $bukti2->extension();
$filePaths['bukti2'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti2->getContent(),
$filename
);
}
if ($request->hasFile('bukti3')) {
$bukti3 = $request->file('bukti3');
$filename = Str::uuid() . '.' . $bukti3->extension();
$filePaths['bukti3'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti3->getContent(),
$filename
);
}
// 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,229 @@
<?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;
use App\Helpers\NextCloudHelper;
use Illuminate\Support\Str;
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';
if ($request->hasFile('bukti1')) {
$bukti1 = $request->file('bukti1');
$filename = Str::uuid() . '.' . $bukti1->extension();
$filePaths['bukti1'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti1->getContent(),
$filename
);
}
if ($request->hasFile('bukti2')) {
$bukti2 = $request->file('bukti2');
$filename = Str::uuid() . '.' . $bukti2->extension();
$filePaths['bukti2'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti2->getContent(),
$filename
);
}
if ($request->hasFile('bukti3')) {
$bukti3 = $request->file('bukti3');
$filename = Str::uuid() . '.' . $bukti3->extension();
$filePaths['bukti3'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti3->getContent(),
$filename
);
}
// 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';
if ($request->hasFile('bukti1')) {
$bukti1 = $request->file('bukti1');
$filename = Str::uuid() . '.' . $bukti1->extension();
$filePaths['bukti1'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti1->getContent(),
$filename
);
}
if ($request->hasFile('bukti2')) {
$bukti2 = $request->file('bukti2');
$filename = Str::uuid() . '.' . $bukti2->extension();
$filePaths['bukti2'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti2->getContent(),
$filename
);
}
if ($request->hasFile('bukti3')) {
$bukti3 = $request->file('bukti3');
$filename = Str::uuid() . '.' . $bukti3->extension();
$filePaths['bukti3'] = $folderPath . '/' . $filename;
NextCloudHelper::uploadFile(
$folderPath,
$bukti3->getContent(),
$filename
);
}
// 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');
}
}
@@ -26,4 +26,9 @@ class FormEntertaimentPresentation extends Model
'account_number', 'account_number',
'status', 'status',
]; ];
public function user()
{
return $this->belongsTo('App\Models\Admin');
}
} }
+5
View File
@@ -23,4 +23,9 @@ class FormMeetingSeminar extends Model
'account_number', 'account_number',
'status', 'status',
]; ];
public function user()
{
return $this->belongsTo(Admin::class, 'user_id');
}
} }
+10
View File
@@ -28,4 +28,14 @@ class FormUpCountry extends Model
'account_number', 'account_number',
'status', 'status',
]; ];
public function user()
{
return $this->belongsTo('App\Models\Admin');
}
public function rayon()
{
return $this->belongsTo('App\Models\Rayon');
}
} }
+5
View File
@@ -26,4 +26,9 @@ class FormVehicleRunningCost extends Model
'account_number', 'account_number',
'status', 'status',
]; ];
public function user()
{
return $this->belongsTo('App\Models\Admin', 'user_id');
}
} }
+10
View File
@@ -14,4 +14,14 @@ class UserHasCabang extends Model
'user_id', 'user_id',
'cabang_id', 'cabang_id',
]; ];
public function user()
{
return $this->belongsTo('App\Models\Admin');
}
public function cabang()
{
return $this->belongsTo('App\Models\Cabang');
}
} }
+1
View File
@@ -16,6 +16,7 @@
"laravolt/avatar": "^6.0", "laravolt/avatar": "^6.0",
"nino/laravel-nextcloud-fs": "^2.0", "nino/laravel-nextcloud-fs": "^2.0",
"phpoffice/phpspreadsheet": "^3.5", "phpoffice/phpspreadsheet": "^3.5",
"singlequote/laravel-webdav": "^1.1",
"spatie/laravel-html": "^3.11", "spatie/laravel-html": "^3.11",
"spatie/laravel-menu": "^4.2", "spatie/laravel-menu": "^4.2",
"spatie/laravel-permission": "^6.10", "spatie/laravel-permission": "^6.10",
Generated
+60 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "e20816a5ac8758dcf14572597c4d7627", "content-hash": "83771e2a711327eac79ef3f7b30673da",
"packages": [ "packages": [
{ {
"name": "barryvdh/laravel-dompdf", "name": "barryvdh/laravel-dompdf",
@@ -4797,6 +4797,65 @@
}, },
"time": "2024-09-06T07:37:46+00:00" "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", "name": "spatie/laravel-html",
"version": "3.11.1", "version": "3.11.1",
+5 -2
View File
@@ -58,11 +58,14 @@ return [
], ],
'nextcloud' => [ 'nextcloud' => [
'driver' => 'nextcloud', 'driver' => 'webdav',
'baseUri' => env('NEXT_CLOUD_URL'), 'baseUri' => env('NEXT_CLOUD_URL'),
'userName' => env('NEXT_CLOUD_USERNAME'), 'userName' => env('NEXT_CLOUD_USERNAME'),
'password' => env('NEXT_CLOUD_PASSWORD'), 'password' => env('NEXT_CLOUD_PASSWORD'),
'directory' => '', 'pathPrefix' => env("NEXT_CLOUD_PATHPREFIX", ''),
'options' => [
'verify' => false,
],
], ],
], ],
+8 -6
View File
@@ -7,6 +7,7 @@ use Database\Seeds\RolePermissionSeeder;
use Database\Seeds\MenuSeeder; use Database\Seeds\MenuSeeder;
use Database\Seeds\RayonSeeder; use Database\Seeds\RayonSeeder;
use Database\Seeds\RolePermissionSeeder2; use Database\Seeds\RolePermissionSeeder2;
use Database\Seeds\RolePermissionSeeder3;
class DatabaseSeeder extends Seeder class DatabaseSeeder extends Seeder
{ {
@@ -17,11 +18,12 @@ class DatabaseSeeder extends Seeder
*/ */
public function run() public function run()
{ {
$this->call(UserSeeder::class); // $this->call(UserSeeder::class);
$this->call(AdminSeeder::class); // $this->call(AdminSeeder::class);
$this->call(RolePermissionSeeder::class); // $this->call(RolePermissionSeeder::class);
$this->call(MenuSeeder::class); // $this->call(MenuSeeder::class);
$this->call(RayonSeeder::class); // $this->call(RayonSeeder::class);
$this->call(RolePermissionSeeder2::class); // $this->call(RolePermissionSeeder2::class);
$this->call(RolePermissionSeeder3::class);
} }
} }
+126
View File
@@ -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;
}
}
@@ -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 Entertainment & Presentation</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.entertainment.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="date" class="form-control" name="tanggal" required value="{{ old('tanggal') }}">
</div>
<div class="mb-3">
<label class="form-label">Jenis</label>
<select class="form-control form-control-md" name="jenis" required>
<option value="">Pilih Jenis</option>
<option value="entertainment" {{ old('jenis') == 'entertainment' ? 'selected' : '' }}>Entertainment</option>
<option value="presentation" {{ old('jenis') == 'presentation' ? 'selected' : '' }}>Presentation</option>
<option value="sponsorship" {{ old('jenis') == 'sponsorship' ? 'selected' : '' }}>Sponsorship</option>
</select>
</div>
<div class="mb-3">
<label class="form-label">Nama Penerima</label>
<input type="text" class="form-control" name="name" required value="{{ old('name') }}">
</div>
<div class="mb-3">
<label class="form-label">Alamat</label>
<input type="text" class="form-control" name="alamat" id="alamat" required value="{{ old('alamat') }}">
</div>
<div class="mb-3">
<label class="form-label">Keterangan</label>
<textarea class="form-control" name="keterangan" required>{{ old('keterangan') }}</textarea>
</div>
</div>
<div class="col-lg-6">
<div class="mb-3">
<label class="form-label">NPWP / NIK</label>
<input type="text" class="form-control" name="nik_or_npwp" id="nik_or_npwp" required value="{{ old('nik_or_npwp') }}">
</div>
<div class="mb-3">
<label class="form-label">Total</label>
<input type="number" class="form-control" name="total" id="total" required value="{{ old('total') }}">
</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,90 @@
@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 Entertainment & Presentation</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.entertainment.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="date" class="form-control" name="tanggal" required value="{{ $form->tanggal }}">
</div>
<div class="mb-3">
<label class="form-label">Jenis</label>
<select class="form-control form-control-md" name="jenis" required>
<option value="">Pilih Jenis</option>
<option value="entertainment" {{ $form->jenis == 'entertainment' ? 'selected' : '' }}>Entertainment</option>
<option value="presentation" {{ $form->jenis == 'presentation' ? 'selected' : '' }}>Presentation</option>
<option value="sponsorship" {{ $form->jenis == 'sponsorship' ? 'selected' : '' }}>Sponsorship</option>
</select>
</div>
<div class="mb-3">
<label class="form-label">Nama Penerima</label>
<input type="text" class="form-control" name="name" required value="{{ $form->name }}">
</div>
<div class="mb-3">
<label class="form-label">Alamat</label>
<input type="text" class="form-control" name="alamat" id="alamat" required value="{{ $form->alamat }}">
</div>
<div class="mb-3">
<label class="form-label">Keterangan</label>
<textarea class="form-control" name="keterangan" required>{{ $form->keterangan }}</textarea>
</div>
</div>
<div class="col-lg-6">
<div class="mb-3">
<label class="form-label">NPWP / NIK</label>
<input type="text" class="form-control" name="nik_or_npwp" id="nik_or_npwp" required value="{{ $form->nik_or_npwp }}">
</div>
<div class="mb-3">
<label class="form-label">Total</label>
<input type="number" class="form-control" name="total" id="total" required value="{{ $form->total }}">
</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">Update</button>
</div>
</form>
</div>
</div>
</div>
</section>
@endsection
@@ -0,0 +1,136 @@
@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 Entertainment & Presentation</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 Entertainment & Presentation</h4>
<p class="float-right mb-2">
@if (auth()->user()->can('forms.entertainment.create'))
<a class="btn btn-primary text-white" href="{{ route('forms.entertainment.create') }}">
Add New Expense Entertainment & Presentation
</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>Jenis</th>
<th>Keterangan</th>
<th>Total</th>
<th>Nama Penerima</th>
<th>NPWP / NIK</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>
@php
use App\Helpers\NextCloudHelper;
@endphp
@foreach ($forms as $item)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $item->user->name }}</td>
<td>{{ \Carbon\Carbon::parse($item->tanggal)->locale('id')->isoFormat('D MMMM Y') }}</td>
<td>{{ $item->jenis }}</td>
<td>{{ $item->keterangan }}</td>
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
<td>{{ $item->name }}</td>
<td>{{ $item->nik_or_npwp }}</td>
<td>
@if ($item->bukti1)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti1) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($item->bukti2)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti2) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($item->bukti3)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti3) }}" target="_blank">
Download
</a>
@else
-
@endif
</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.entertainment.edit'))
<a href="{{ route('forms.entertainment.edit', $item->id) }}" class="btn btn-warning btn-sm">
<i class="fas fa-edit text-white"></i>
</a>
@endif
@if (auth()->user()->can('forms.entertainment.delete'))
<form action="{{ route('forms.entertainment.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
@@ -0,0 +1,124 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<script src="https://cdn.jsdelivr.net/npm/autonumeric@4.6.0/dist/autoNumeric.min.js"></script>
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Tambahkan Expense Meeting & Seminar 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.meeting.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">Allowance</label>
<input type="text" class="form-control" name="allowance" id="allowance" required value="{{ old('allowance') }}">
</div>
<div class="mb-3">
<label class="form-label">Transport Antar Kota</label>
<input type="text" 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="text" class="form-control" name="hotel" id="hotel" required value="{{ old('hotel') }}">
</div>
<div class="mb-3">
<label class="form-label">Total</label>
<input type="text" class="form-control" name="total" id="total" required value="{{ old('total') }}">
</div>
</div>
<div class="col-lg-6">
<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>
<script>
new AutoNumeric('#allowance', {
digitGroupSeparator: '.', // Pemisah ribuan
decimalCharacter: ',', // Karakter desimal (tidak digunakan karena tanpa desimal)
currencySymbol: 'Rp.', // Simbol mata uang
decimalPlaces: 0, // Tidak ada angka desimal
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
});
new AutoNumeric('#transport_ankot', {
digitGroupSeparator: '.', // Pemisah ribuan
decimalCharacter: ',', // Karakter desimal (tidak digunakan karena tanpa desimal)
currencySymbol: 'Rp.', // Simbol mata uang
decimalPlaces: 0, // Tidak ada angka desimal
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
});
new AutoNumeric('#hotel', {
digitGroupSeparator: '.', // Pemisah ribuan
decimalCharacter: ',', // Karakter desimal (tidak digunakan karena tanpa desimal)
currencySymbol: 'Rp.', // Simbol mata uang
decimalPlaces: 0, // Tidak ada angka desimal
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
});
</script>
<script>
const allowance = document.getElementById('allowance');
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 transportAnkotValue = parseInt(transportAnkot.value) || 0;
const hotelValue = parseInt(hotel.value) || 0;
total.value = allowanceValue + transportAnkotValue + hotelValue;
}
// Attach event listeners
[allowance, transportAnkot, hotel].forEach(input => {
input.addEventListener('input', calculateTotal);
});
// Initial calculation on page load
calculateTotal();
</script>
@endsection
@@ -0,0 +1,125 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<script src="https://cdn.jsdelivr.net/npm/autonumeric@4.6.0/dist/autoNumeric.min.js"></script>
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Edit Expense Meeting & Seminar</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.meeting.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">Allowance</label>
<input type="text" class="form-control" name="allowance" id="allowance" required value="{{ $form->allowance }}">
</div>
<div class="mb-3">
<label class="form-label">Transport Antar Kota</label>
<input type="text" 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="text" class="form-control" name="hotel" id="hotel" required value="{{ $form->hotel }}">
</div>
<div class="mb-3">
<label class="form-label">Total</label>
<input type="text" class="form-control" name="total" id="total" required value="{{ $form->total }}">
</div>
</div>
<div class="col-lg-6">
<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>
<script>
new AutoNumeric('#allowance', {
digitGroupSeparator: '.', // Pemisah ribuan
decimalCharacter: ',', // Karakter desimal (tidak digunakan karena tanpa desimal)
currencySymbol: 'Rp.', // Simbol mata uang
decimalPlaces: 0, // Tidak ada angka desimal
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
});
new AutoNumeric('#transport_ankot', {
digitGroupSeparator: '.', // Pemisah ribuan
decimalCharacter: ',', // Karakter desimal (tidak digunakan karena tanpa desimal)
currencySymbol: 'Rp.', // Simbol mata uang
decimalPlaces: 0, // Tidak ada angka desimal
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
});
new AutoNumeric('#hotel', {
digitGroupSeparator: '.', // Pemisah ribuan
decimalCharacter: ',', // Karakter desimal (tidak digunakan karena tanpa desimal)
currencySymbol: 'Rp.', // Simbol mata uang
decimalPlaces: 0, // Tidak ada angka desimal
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
});
</script>
<script>
const allowance = document.getElementById('allowance');
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 transportAnkotValue = parseInt(transportAnkot.value) || 0;
const hotelValue = parseInt(hotel.value) || 0;
total.value = allowanceValue + transportAnkotValue + hotelValue;
}
// Attach event listeners
[allowance, transportAnkot, hotel].forEach(input => {
input.addEventListener('input', calculateTotal);
});
// Initial calculation on page load
calculateTotal();
</script>
@endsection
@@ -0,0 +1,134 @@
@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 Meeting Seminar</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 Meeting Seminar Anda</h4>
<p class="float-right mb-2">
@if (auth()->user()->can('forms.meeting.create'))
<a class="btn btn-primary text-white" href="{{ route('forms.meeting.create') }}">
Add New Expense Meeting Seminar
</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>Allowance</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>
@php
use App\Helpers\NextCloudHelper;
@endphp
@foreach ($forms as $item)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $item->user->name }}</td>
<td>{{ \Carbon\Carbon::parse($item->created_at)->locale('id')->isoFormat('D MMMM Y') }}</td>
<td>{{ number_format($item->allowance, 0, ',', '.') }}</td>
<td>{{ number_format($item->transport_ankot, 0, ',', '.') }}</td>
<td>{{ number_format($item->hotel, 0, ',', '.') }}</td>
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
<td>
@if ($item->bukti1)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti1) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($item->bukti2)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti2) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($item->bukti3)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti3) }}" target="_blank">
Download
</a>
@else
-
@endif
</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.meeting.edit'))
<a href="{{ route('forms.meeting.edit', $item->id) }}" class="btn btn-warning btn-sm">
<i class="fas fa-edit text-white"></i>
</a>
@endif
@if (auth()->user()->can('forms.meeting.delete'))
<form action="{{ route('forms.meeting.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
@@ -24,12 +24,14 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-body"> <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="row">
<div class="col-lg-6"> <div class="col-lg-6">
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Pilih Rayon</label> <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> <option value="">Pilih Rayon</option>
@foreach ($rayons as $rayon) @foreach ($rayons as $rayon)
<option value="{{ $rayon->id }}">{{ $rayon->name }}</option> <option value="{{ $rayon->id }}">{{ $rayon->name }}</option>
@@ -38,50 +40,50 @@
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Tanggal</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Tujuan</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Jarak</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Allowance</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Transport Dalam Kota</label> <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> </div>
<div class="col-lg-6"> <div class="col-lg-6">
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Transport Antar Kota</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Hotel</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Total</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Bukti 1</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Bukti 2</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Bukti 3</label> <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>
</div> </div>
@@ -92,4 +94,30 @@
</div> </div>
</div> </div>
</section> </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 @endsection
@@ -24,72 +24,101 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-body"> <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="row">
<div class="col-lg-6"> <div class="col-lg-6">
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Pilih Rayon</label> <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> <option value="">Pilih Rayon</option>
@foreach ($rayons as $rayon) @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 @endforeach
</select> </select>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Tanggal</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Tujuan</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Jarak</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Allowance</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Transport Dalam Kota</label> <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> </div>
<div class="col-lg-6"> <div class="col-lg-6">
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Transport Antar Kota</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Hotel</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Total</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Bukti 1</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Bukti 2</label> <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>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Bukti 3</label> <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>
</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> </div>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
</section> </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 @endsection
@@ -26,9 +26,11 @@
<div class="card-body"> <div class="card-body">
<h4 class="header-title float-left">List Data Forms Up Country Anda</h4> <h4 class="header-title float-left">List Data Forms Up Country Anda</h4>
<p class="float-right mb-2"> <p class="float-right mb-2">
<a class="btn btn-primary text-white" href=""> @if (auth()->user()->can('forms.country.create'))
Add New Expense Up Country <a class="btn btn-primary text-white" href="{{ route('forms.up-country.create') }}">
</a> Add New Expense Up Country
</a>
@endif
</p> </p>
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="dataTables_wrapper dt-bootstrap4 mt-2"> <div class="dataTables_wrapper dt-bootstrap4 mt-2">
@@ -45,41 +47,85 @@
<th>Tujuan</th> <th>Tujuan</th>
<th>Jarak</th> <th>Jarak</th>
<th>Allowance</th> <th>Allowance</th>
<th>Transport Dalkot</th> <th>Total</th>
<th>Transport Ankot</th>
<th>Hotel</th>
<th>Bukti 1</th> <th>Bukti 1</th>
<th>Bukti 2</th> <th>Bukti 2</th>
<th>Bukti 3</th> <th>Bukti 3</th>
<th>Account Number</th> <th>Account Number</th>
<th>Status</th>
<th>Aksi</th> <th>Aksi</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> @php
<td>1</td> use App\Helpers\NextCloudHelper;
<td>John Doe</td> @endphp
<td>Rayon 1</td> @foreach ($forms as $item)
<td>2021-09-01</td> <tr>
<td>Surabaya</td> <td>{{ $loop->iteration }}</td>
<td>100</td> <td>{{ $item->user->name }}</td>
<td>100000</td> <td>{{ $item->rayon->code }}</td>
<td>10000</td> <td>{{ \Carbon\Carbon::parse($item->tanggal)->locale('id')->isoFormat('D MMMM Y') }}</td>
<td>5000</td> <td>{{ $item->tujuan }}</td>
<td>50000</td> <td>{{ $item->jarak }} km</td>
<td>file1.jpg</td> <td>{{ number_format($item->allowance, 0, ',', '.') }}</td>
<td>file2.jpg</td> <td>{{ number_format($item->total, 0, ',', '.') }}</td>
<td>file3.jpg</td> <td>
<td>1234567890</td> @if ($item->bukti1)
<td> <a href="{{ NextCloudHelper::getFileUrl($item->bukti1) }}" target="_blank">
<a href="" class="btn btn-warning btn-sm"> Download
<i class="fas fa-edit text-white"></i> </a>
</a> @else
<a href="" class="btn btn-danger btn-sm"> -
<i class="fas fa-trash"></i> @endif
</a> </td>
</td> <td>
</tr> @if ($item->bukti2)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti2) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($item->bukti3)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti3) }}" target="_blank">
Download
</a>
@else
-
@endif
</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> </tbody>
</table> </table>
</div> </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,136 @@
@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>
@php
use App\Helpers\NextCloudHelper;
@endphp
@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>{{ number_format($item->harga, 0, ',', '.') }}</td>
<td>{{ $item->jarak }}</td>
<td>{{ $item->tipe_bensin }}</td>
<td>{{ $item->nopol }}</td>
<td>
@if ($item->bukti1)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti1) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($item->bukti2)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti2) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($item->bukti3)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti3) }}" target="_blank">
Download
</a>
@else
-
@endif
</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"> <section class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-12 mt-5"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<h4 class="header-title float-left">{{ $pageInfo['sub_title'] }}</h4> <h4 class="header-title float-left">{{ $pageInfo['sub_title'] }}</h4>
@@ -38,7 +38,7 @@
<div class="main-content-inner"> <div class="main-content-inner">
<div class="row"> <div class="row">
<!-- data table start --> <!-- data table start -->
<div class="col-12 mt-5"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<h4 class="header-title float-left">Users List</h4> <h4 class="header-title float-left">Users List</h4>
@@ -15,6 +15,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/Ladda/1.0.6/spin.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/Ladda/1.0.6/spin.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Ladda/1.0.6/ladda.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/Ladda/1.0.6/ladda.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/fiqhpratama/upsense-cdn@main/adminlte-blue/plugins/waitme/waitMe.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/fiqhpratama/upsense-cdn@main/adminlte-blue/plugins/waitme/waitMe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/autonumeric@4.6.0/dist/autoNumeric.min.js"></script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
+39 -1
View File
@@ -12,6 +12,11 @@ use App\Http\Controllers\Forms\FormUpCountryController;
use App\Http\Controllers\Master\RayonController; use App\Http\Controllers\Master\RayonController;
use App\Http\Controllers\Master\CostCentreController; use App\Http\Controllers\Master\CostCentreController;
use App\Http\Controllers\Master\CategoryController; use App\Http\Controllers\Master\CategoryController;
use App\Http\Controllers\Forms\FormVehicleController;
use App\Http\Controllers\Forms\FormEntertainmentPresentationController;
use App\Http\Controllers\Forms\FormMeetingSeminarController;
use Illuminate\Support\Facades\Storage;
use App\Helpers\NextCloudHelper;
Auth::routes(); Auth::routes();
@@ -70,9 +75,42 @@ Route::middleware(['auth:admin', 'menu'])->group(function () {
Route::get('/up-country/edit/{id}', [FormUpCountryController::class, 'edit'])->name('forms.up-country.edit'); 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::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'); 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');
// Entertainment & Presentation
Route::get('/entertainment-presentation', [FormEntertainmentPresentationController::class, 'index'])->name('forms.entertainment');
Route::get('/entertainment-presentation/create', [FormEntertainmentPresentationController::class, 'create'])->name('forms.entertainment.create');
Route::post('/entertainment-presentation/store', [FormEntertainmentPresentationController::class, 'store'])->name('forms.entertainment.store');
Route::get('/entertainment-presentation/edit/{id}', [FormEntertainmentPresentationController::class, 'edit'])->name('forms.entertainment.edit');
Route::put('/entertainment-presentation/update/{id}', [FormEntertainmentPresentationController::class, 'update'])->name('forms.entertainment.update');
Route::delete('/entertainment-presentation/destroy/{id}', [FormEntertainmentPresentationController::class, 'destroy'])->name('forms.entertainment.destroy');
// Meeting & Seminar
Route::get('/meeting-seminar', [FormMeetingSeminarController::class, 'index'])->name('forms.meeting');
Route::get('/meeting-seminar/create', [FormMeetingSeminarController::class, 'create'])->name('forms.meeting.create');
Route::post('/meeting-seminar/store', [FormMeetingSeminarController::class, 'store'])->name('forms.meeting.store');
Route::get('/meeting-seminar/edit/{id}', [FormMeetingSeminarController::class, 'edit'])->name('forms.meeting.edit');
Route::put('/meeting-seminar/update/{id}', [FormMeetingSeminarController::class, 'update'])->name('forms.meeting.update');
Route::delete('/meeting-seminar/destroy/{id}', [FormMeetingSeminarController::class, 'destroy'])->name('forms.meeting.destroy');
}); });
//Menu Role //Menu Role
Route::get('/auth/menu-tree/{id}', [MenuRoleController::class, 'index'])->name('auth.menurole.index'); 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::post('/auth/menu-tree/submit', [MenuRoleController::class, 'saveMenu'])->name('auth.menurole.submit');
}); });
Route::get('/test-nextcloud', function () {
$baseUrl = env('NEXT_CLOUD_URL');
$adminUsername = env('NEXT_CLOUD_USERNAME');
$adminPassword = env('NEXT_CLOUD_PASSWORD');
$response = NextCloudHelper::createFolder($baseUrl, $adminUsername, $adminPassword, 'test-folder');
dd($response);
});