update pemilihan team hanya surveyor atau penilai dan update form foto menggunakan camera

This commit is contained in:
majid
2024-10-29 14:22:25 +07:00
parent 13d7b1c4fd
commit 4b08225403
33 changed files with 1477 additions and 314 deletions

View File

@@ -280,15 +280,14 @@
<label class="form-label max-w-56">
Penilai yang Dilakukan oleh
</label>
<input type="hidden" name="nomor_registrasi"
value="{{ $penilaian->nomor_registrasi ?? $permohonan->nomor_registrasi }}">
<div class="flex flex-wrap items-baseline w-full">
<input class="input"
type="hidden" name="jenis_penilaian_id" value="{{ $jenisPenilaian->id }}"
>
<input class="input" type="hidden" name="jenis_penilaian_id"
value="{{ $jenisPenilaian->id }}">
<input class="input @error('jenis_penilaian_id') border-danger bg-danger-light @enderror"
type="text" value="{{ $jenisPenilaian->name }}"
readonly>
type="text" value="{{ $jenisPenilaian->name }}" readonly>
@error('jenis_penilaian_id')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
@@ -300,9 +299,7 @@
Tim Penilai yang di tunjuk
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input"
type="hidden" name="teams_id" value="{{ $regionName->id }}"
>
<input class="input" type="hidden" name="teams_id" value="{{ $regionName->id }}">
<input class="input @error('teams_id') border-danger bg-danger-light @enderror"
type="text" value="{{ $regionName->name }}" readonly>
@error('teams_id')
@@ -311,62 +308,115 @@
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Surveyor yang di tunjuk
Pilih Surveyor dan Penilai
</label>
<div class="flex flex-wrap items-baseline w-full">
<select id="surveyor_id" name="surveyor_id"
class="tomselect input @error('surveyor_id') border-danger bg-danger-light @enderror w-full">
<option value="">Pilih Surveyor</option>
@foreach ($teamPenilai->first()->teamsUsers as $item)
<option value="{{ $item->user->id }}">{{ $item->user->name }}</option>
@endforeach
</select>
<div class="input-group w-full">
<select id="surveyor_selection" name="surveyor_selection"
class="tomselect input @error('surveyor_selection') border-danger bg-danger-light @enderror w-full">
<option value="">Pilih Surveyor dan Penilai</option>
<option value="penilai_dan_surveyor">Penilai dan Surveyor Sama</option>
<option value="berbeda">Berbeda</option>
</select>
</div>
@error('surveyor_id')
@error('surveyor_selection')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Penilai yang di tunjuk
</label>
<div class="flex flex-wrap items-baseline w-full">
<select id="penilaian_id" name="penilaian_id"
class="input tomselect @error('penilaian_id') border-danger bg-danger-light @enderror w-full">
<option value="">Pilih Penilai</option>
@foreach ($teamPenilai->first()->teamsUsers as $item)
<option value="{{ $item->user->id }}">{{ $item->user->name }}</option>
@endforeach
</select>
@error('penilaian_id')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
<div id="same_surveyor_penilai" class="hidden">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Surveyor dan Penilai yang di tunjuk
</label>
<div class="flex flex-wrap items-baseline w-full">
<div class="input-group w-full">
<select id="penilai_surveyor_id" name="penilai_surveyor_id"
class="input tomselect @error('penilai_surveyor_id') border-danger bg-danger-light @enderror w-full">
<option value="">Pilih Surveyor dan Penilai</option>
@foreach ($teamPenilai->first()->teamsUsers as $item)
<option value="{{ $item->user->id }}">{{ $item->user->name }}</option>
@endforeach
</select>
</div>
@error('penilai_surveyor_id')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Surveyor dan penilai yang di tunjuk
</label>
<div class="flex flex-wrap items-baseline w-full">
<select id="penilai_surveyor_id" name="penilai_surveyor_id"
class="input tomselect @error('penilai_surveyor_id') border-danger bg-danger-light @enderror w-full">
<option value="">Pilih Surveyor dan Penilai</option>
@foreach ($teamPenilai->first()->teamsUsers as $item)
<option value="{{ $item->user->id }}">{{ $item->user->name }}</option>
@endforeach
</select>
@error('penilai_surveyor_id')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
<div id="different_surveyor_penilai" class="hidden">
<div id="surveyorId" class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Surveyor yang di tunjuk
</label>
<div class="flex flex-wrap items-baseline w-full">
<div class="input-group w-full">
<select id="surveyor_id" name="surveyor_id"
class="tomselect input @error('surveyor_id') border-danger bg-danger-light @enderror w-full">
<option value="">Pilih Surveyor</option>
@foreach ($teamPenilai->first()->teamsUsers as $item)
<option value="{{ $item->user->id }}">{{ $item->user->name }}</option>
@endforeach
<option value="pilih_dari_region">pilih dari region berdeda</option>
</select>
</div>
@error('surveyor_id')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div id="surveyorRegion" class="hidden items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Pilih Region
</label>
<div class="flex flex-wrap items-baseline w-full">
<div class="input-group w-full">
<select id="surveyor_id" name="surveyor_id"
class="tomselect input @error('surveyor_id') border-danger bg-danger-light @enderror w-full">
<option value="">Pilih Region</option>
<option value="pilih_dari_region">Pilih dari region berdeda</option>
</select>
</div>
@error('surveyor_id')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div id="penilaiId" class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Penilai yang di tunjuk
</label>
<div class="flex flex-wrap items-baseline w-full">
<div class="input-group w-full">
<select id="penilaian_id" name="penilaian_id"
class="input tomselect @error('penilaian_id') border-danger bg-danger-light @enderror w-full">
<option value="">Pilih Penilai</option>
@foreach ($teamPenilai->first()->teamsUsers as $item)
<option value="{{ $item->user->id }}">{{ $item->user->name }}</option>
@endforeach
</select>
<button type="button" id="btnPenilai" class="btn btn-light">
<i class="ki-outline ki-notepad-edit"></i> Pilih dari region berbeda
</button>
</div>
@error('penilaian_id')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Jadwal Kunjungan
@@ -404,16 +454,9 @@
Revisi
</button>
</div>
</form>
</div>
</div>
</div>
@@ -473,8 +516,51 @@
</div>
@endsection
@push('scripts')
<script>
document.getElementById('surveyor_selection').addEventListener('change', function() {
const selectedValue = this.value;
const sameSurveyorPenilai = document.getElementById('same_surveyor_penilai');
const differentSurveyorPenilai = document.getElementById('different_surveyor_penilai');
if (selectedValue === 'penilai_dan_surveyor') {
sameSurveyorPenilai.classList.remove('hidden');
differentSurveyorPenilai.classList.add('hidden');
} else if (selectedValue === 'berbeda') {
sameSurveyorPenilai.classList.add('hidden');
differentSurveyorPenilai.classList.remove('hidden');
} else {
sameSurveyorPenilai.classList.add('hidden');
differentSurveyorPenilai.classList.add('hidden');
}
});
document.getElementById('surveyor_id').addEventListener('change', function() {
const selectedValue = this.value;
const surveyorRegion = document.getElementById('surveyorRegion');
if (selectedValue === 'pilih_dari_region') {
surveyorRegion.classList.remove('hidden');
}else{
surveyorRegion.classList.add('hidden');
}
});
function handleRegionBerbeda(params) {
const surveyor = document.getElementById('btnSurveyor');
const penilai = document.getElementById('btnPenilai');
const surveyorId = document.getElementById('surveyorRegion');
surveyor.addEventListener('click', function() {
surveyorId.classList.add('hidden');
});
}
document.addEventListener('DOMContentLoaded', function() {
const revisiForm = document.getElementById('revisiForm');
const btnSubmit = document.getElementById('btnSubmit');

View File

@@ -1,8 +1,8 @@
@extends('layouts.main')
{{-- @section('breadcrumbs')
{{ Breadcrumbs::render('penilaian') }}
@endsection --}}
@section('breadcrumbs')
{{ Breadcrumbs::render('otorisator.'. strtolower($header)) }}
@endsection
@section('content')
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
@@ -86,6 +86,42 @@
@push('scripts')
<script>
function otorisator(){
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes!'
}).then((result) => {
if (result.isConfirmed) {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
}
});
$.ajax(`permohonan/${data}`, {
type: 'POST'
}).then((response) => {
swal.fire('eddited!', 'Pelaporan has been edited.', 'success').then(() => {
window.location.reload();
});
}).catch((error) => {
console.error('Error:', error);
Swal.fire('Error!', 'An error occurred while file.', 'error');
});
}
})
}
</script>
<script type="module">
const element = document.querySelector('#permohonan-table');
const searchInput = document.getElementById('search');
@@ -142,6 +178,12 @@
title: 'Status',
render: (item, data) => {
return `<div class="flex flex-nowrap justify-center">
<a class="btn btn-sm btn-icon btn-clear btn-success " onclick="otorisator(${data.id})">
<i class="ki-filled ki-check-squared"></i>
</a>
<a class="btn btn-sm btn-icon btn-clear btn-warning " href="otorisator/show/${data.id}">
<i class="ki-outline ki-eye"></i>
</a>

View File

@@ -146,7 +146,7 @@
</div>
<div class="card">
<form action="{{ route('authorization.update', $permohonan->id) }}" method="POST">
<form id="approveForm" action="{{ route('authorization.update', $permohonan->id) }}" method="POST">
<input type="hidden" name="_method" value="PUT">
@csrf
<div class="card-body lg:py-7.5">
@@ -160,14 +160,34 @@
</div>
</div>
<div class="card-footer flex justify-end">
<button type="submit" name="status" value="preregister" class="btn btn-success">
<button onclick="return otorisator()" type="button" name="status" value="preregister" class="btn btn-success">
Approve
</button>
<button type="submit" name="status" value="revisi" class="btn btn-warning ml-3">
Revisi
</button>
</div>
</form>
</div>
</div>
@endsection
@push('scripts')
<script>
function otorisator(){
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes!'
}).then((result) => {
if (result.isConfirmed) {
document.getElementById('approveForm').submit();
}
})
}
</script>
@endpush