Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
simpmw
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alfiro Pratama
simpmw
Commits
57a03e77
Commit
57a03e77
authored
Jan 07, 2025
by
Alfiro Pratama
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix upload url produk akhir
parent
2c14aca4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
24 deletions
+83
-24
app/Http/Controllers/Mahasiswa/MonevController.php
+81
-22
resources/views/backend/mahasiswa/monev/upload_monev.blade.php
+2
-2
No files found.
app/Http/Controllers/Mahasiswa/MonevController.php
View file @
57a03e77
...
...
@@ -128,15 +128,13 @@ class MonevController extends Controller
return
view
(
'backend.mahasiswa.monev.upload_monev'
,
$data
);
}
public
function
uploadMonev
(
Request
$request
)
{
//
$pro
=
$request
->
except
(
'_token'
);
$this
->
validate
(
$request
,
[
'file'
=>
'
required|
mimes:pdf|max:5000'
'file'
=>
'mimes:pdf|max:5000'
],
[
'file.required'
=>
'Tidak ada file yang di upload'
,
'file.mimes'
=>
'File harus pdf'
,
...
...
@@ -145,49 +143,110 @@ class MonevController extends Controller
$proposal
=
MonevInternal
::
with
([
'rProposal'
])
->
find
(
$pro
[
'monev_id'
]);
if
(
$pro
[
'type'
]
!==
'produk'
)
{
$file_nama
=
$proposal
->
rProposal
->
rPeriode
->
nama
.
'_'
.
$proposal
->
rProposal
->
proposal_id
.
'.'
.
$pro
[
'file'
]
->
getClientOriginalExtension
();
Storage
::
disk
(
'static'
)
->
put
(
'simpmw/monev/'
.
$pro
[
'monev'
]
.
'/'
.
$pro
[
'type'
]
.
'/'
.
$file_nama
,
file_get_contents
(
$pro
[
'file'
]
->
getRealPath
()));
if
(
$pro
[
'type'
]
==
'logbook'
){
$proposal
->
logbook_file
=
$file_nama
;
$proposal
->
logbook_date
=
now
();
}
elseif
(
$pro
[
'type'
]
==
'kemajuan'
){
$proposal
->
kemajuan_file
=
$file_nama
;
$proposal
->
kemajuan_date
=
now
();
}
elseif
(
$pro
[
'type'
]
==
'akhir'
){
$proposal
->
akhir_file
=
$file_nama
;
$proposal
->
akhir_date
=
now
();
}
elseif
(
$pro
[
'type'
]
==
'produk'
){
$request
->
validate
([
'produk_url'
=>
'required|url'
,
// Validasi bahwa produk_url harus berupa URL yang valid
]);
if
(
$pro
[
'type'
]
==
'logbook'
){
$proposal
->
logbook_file
=
$file_nama
;
$proposal
->
logbook_date
=
now
();
}
elseif
(
$pro
[
'type'
]
==
'kemajuan'
){
$proposal
->
kemajuan_file
=
$file_nama
;
$proposal
->
kemajuan_date
=
now
();
}
elseif
(
$pro
[
'type'
]
==
'akhir'
){
$proposal
->
akhir_file
=
$file_nama
;
$proposal
->
akhir_date
=
now
();
}
elseif
(
$pro
[
'type'
]
==
'proposal'
){
$proposal
->
upload_dokumen
=
$file_nama
;
$proposal
->
date_upload
=
now
();
}
}
else
{
$proposal
->
produk_url
=
$request
->
produk_url
;
$proposal
->
produk_date
=
now
();
}
elseif
(
$pro
[
'type'
]
==
'proposal'
){
$proposal
->
upload_dokumen
=
$file_nama
;
$proposal
->
date_upload
=
now
();
}
$proposal
->
save
();
return
redirect
()
->
route
(
'mahasiswa.monev-index'
,
$pro
[
'monev'
])
->
with
(
'success'
,
'Proposal Berhasil revisi'
);
}
public
function
revisiMonevAll
(
$id
)
{
$id
=
explode
(
'__'
,
decrypt
(
$id
));
// $proposal = MonevInternal::with(['rProposal'])->find($id[0]);
$proposal
=
MonevInternal
::
with
([
'rProposal'
])
->
where
(
'id'
,
$id
[
0
])
->
first
();
$id
[
1
]
==
'II'
?
$title
=
'Revisi Dokumen Monev II'
:
$title
=
'Revisi Dokumen Monev I'
;
$type
=
[
'proposal'
,
'logbook'
,
'kemajuan'
,
'akhir'
,
'produk'
];
$label
=
[
'Unggah Revisi Proposal'
,
'Unggah Revisi Logbook'
,
'Unggah Revisi Laporan Kemajuan'
,
'Unggah Revisi Laporan Akhir'
,
'Unggah Revisi Produk Akhir'
];
$data
=
[
'proposal'
=>
$proposal
,
'title'
=>
$title
,
'type'
=>
$type
,
'monev'
=>
$id
[
1
],
'label'
=>
$label
,
];
return
view
(
'backend.mahasiswa.monev.revisi_monev'
,
$data
);
}
public
function
uploadMonevRevisi
(
Request
$request
)
{
$pro
=
$request
->
except
(
'_token'
);
$type
=
[
'proposal'
,
'logbook'
,
'kemajuan'
,
'akhir'
,
'produk'
];
$request
->
validate
([
'produk_url'
=>
'nullable|url'
,
// Produk URL validasi opsional
'proposal'
=>
'nullable|mimes:pdf|max:5000'
,
'logbook'
=>
'nullable|mimes:pdf|max:5000'
,
'kemajuan'
=>
'nullable|mimes:pdf|max:5000'
,
'akhir'
=>
'nullable|mimes:pdf|max:5000'
,
],
[
'mimes'
=>
':attribute harus berupa file PDF.'
,
'max'
=>
':attribute tidak boleh lebih dari 5MB.'
,
// 'produk_url.url' => 'Produk URL harus berupa URL valid.',
]);
$proposal
=
MonevInternal
::
with
([
'rProposal'
])
->
find
(
$pro
[
'monev_id'
]);
foreach
(
$type
as
$field
)
{
if
(
$field
===
'produk'
&&
isset
(
$pro
[
'produk_url'
]))
{
$proposal
->
produk_url
=
$pro
[
'produk_url'
];
$proposal
->
produk_date
=
now
();
}
elseif
(
isset
(
$pro
[
$field
]))
{
$file
=
$pro
[
$field
];
$file_nama
=
$proposal
->
rProposal
->
rPeriode
->
nama
.
'_'
.
$proposal
->
rProposal
->
proposal_id
.
'.'
.
$file
->
getClientOriginalExtension
();
$store
=
Storage
::
disk
(
'static'
)
->
put
(
'simpmw/monev/'
.
$pro
[
'monev'
]
.
'/'
.
$field
.
'/'
.
$file_nama
,
file_get_contents
(
$file
->
getRealPath
()));
$url
=
'simpmw/monev/'
.
$pro
[
'monev'
]
.
'/'
.
$field
.
'/'
.
$file_nama
;
$proposal
->
{
$field
.
'_file'
}
=
$file_nama
;
$proposal
->
{
$field
.
'_date'
}
=
now
();
$urls
[]
=
$url
;
}
}
dd
(
$pro
,
$urls
,
$store
);
$proposal
->
save
();
return
redirect
()
->
route
(
'mahasiswa.monev-index'
,
$pro
[
'monev'
])
->
with
(
'success'
,
'Proposal Berhasil revisi'
);
}
public
function
buktiAnggaran
(
$id
)
{
$monev
=
decrypt
(
$id
);
$monev
_id
=
decrypt
(
$id
);
$title
=
'Bukti Penggunaan Anggaran'
;
$anggaran
=
BuktiAnggaran
::
with
([
'rProposal'
,
'rMonev'
])
->
where
(
'monev_id'
,
$monev
)
->
where
(
'monev_id'
,
$monev
_id
)
->
get
();
$monev
=
MonevInternal
::
with
([
'rProposal'
,
'rBuktiAnggaran'
=>
function
(
$query
)
{
$query
->
orderByRaw
(
'CASE WHEN tgl_pembelian IS NULL THEN 0 ELSE 1 END ASC, tgl_pembelian ASC'
);
}])
->
where
(
'id'
,
$monev
)
->
where
(
'id'
,
$monev
_id
)
->
first
();
$jenis_satuan
=
JenisSatuanBarang
::
select
(
'jenis_satuan'
)
...
...
resources/views/backend/mahasiswa/monev/upload_monev.blade.php
View file @
57a03e77
...
...
@@ -69,13 +69,13 @@
@if (
$errors->has
('produk_url'))
<span class="
text
-
danger
">{{
$errors->first
('produk_url') }}</span>
@endif
<input type="
text
" name="
produk_url
" class="
form
-
control
" id="
input
-
form
" value="
{{
old
(
'produk_url'
)
}}
">
<input type="
text
" name="
produk_url
" class="
form
-
control
" id="
input
-
form
" value="
{{
old
(
'produk_url'
)
}}
"
required
>
</div>
@else
<div class="
col
-
sm
-
10
">
<div class="
row
">
<div class="
col
-
8
">
<input type="
file
" name="
file
" class="
form
-
control
" id="
input
-
file
" accept="
application
/
pdf
">
<input type="
file
" name="
file
" class="
form
-
control
" id="
input
-
file
" accept="
application
/
pdf
"
required
>
@if (
$errors->has
('file'))
<span class="
text
-
danger
">{{
$errors->first
('file') }}</span>
@endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment