Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
3
3f-timesheet
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dockers
3f-timesheet
Commits
b2733f9f
Commit
b2733f9f
authored
Aug 15, 2022
by
hannan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crud upload attachment files
parent
cc0a7c6f
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
226 additions
and
12 deletions
+226
-12
database/migrations/2022_08_15_105428_create_notes_attachement_table.php
+33
-0
packages/portal/timesheet/resources/views/dashboard/timesheetViewer.blade.php
+25
-1
packages/portal/timesheet/resources/views/form/notelist.blade.php
+58
-9
packages/portal/timesheet/routes/web.php
+1
-0
packages/portal/timesheet/src/Http/Controllers/DashboardController.php
+2
-0
packages/portal/timesheet/src/Http/Controllers/FormController.php
+76
-0
packages/portal/timesheet/src/Model/NotesAttachement.php
+29
-0
packages/portal/timesheet/src/Model/ts_master.php
+2
-2
public/uploads/timesheet/notes/7/5S trail.jpg
+0
-0
public/uploads/timesheet/notes/7/Hannan.jpeg
+0
-0
public/uploads/timesheet/notes/7/WhatsApp Image 2021-07-03 at 3.05.40 PM.jpeg
+0
-0
public/uploads/timesheet/notes/7/site visit.JPG
+0
-0
No files found.
database/migrations/2022_08_15_105428_create_notes_attachement_table.php
0 → 100644
View file @
b2733f9f
<?php
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
class
CreateNotesAttachementTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'notes_attachement'
,
function
(
Blueprint
$table
)
{
$table
->
increments
(
'id'
);
$table
->
integer
(
'fk_timesheet_master'
)
->
nullable
();
$table
->
string
(
'path'
)
->
nullable
();
$table
->
timestamps
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'notes_attachement'
);
}
}
packages/portal/timesheet/resources/views/dashboard/timesheetViewer.blade.php
View file @
b2733f9f
...
...
@@ -505,7 +505,7 @@
<table id="
printtable5
" class="
ui
celled
structured
table
unstackable
">
<thead>
<tr>
<th colspan="
2
" class="
center
aligned
">Note</th>
<th colspan="
2
" class="
center
aligned
">Note
s
</th>
</tr>
</thead>
<tbody>
...
...
@@ -523,6 +523,30 @@
@endif
</tbody>
</table>
@if(data_get(
$check
,'attachement'))
<table id="
printtable5
" class="
ui
celled
structured
table
unstackable
">
<thead>
<tr>
<th colspan="
2
" class="
center
aligned
">Notes Attachment</th>
</tr>
</thead>
<tbody>
<tr>
<td style="
width
:
13.5
%
;
">Notes Attachement</td>
<td>
<a href="
{{
asset
(
data_get
(
$check
,
'attachement.path'
))}}
" target="
_blank
">
<button class="
ui
active
button
">
<i class="
download
icon
"></i>
Download
</button>
</a>
</td>
</tr>
</tbody>
</table>
@endif
</div>
<div class="
ui
segment
">
...
...
packages/portal/timesheet/resources/views/form/notelist.blade.php
View file @
b2733f9f
...
...
@@ -2,14 +2,44 @@
@
section
(
'content'
)
<
div
class
="
ui
small
modal
uploadmodal
">
<div class="
header
">
Upload Attachment
</div>
<div class="
content
">
<form class="
ui
form
" action="
/
action
/
upload
" method="
POST
" enctype="
multipart
/
form
-
data
">
{
{csrf_field()}
}
<input type="
hidden
" name="
id
" value="
{{
$fk_tm_id
}}
">
<div class="
field
">
<label>Title</label>
<input type="
file
" name="
attachment
" id="
uploadfile
" style="">
</div>
<button class="
ui
blue
button
" type="
submit
">Upload</button>
</form>
</div>
</div>
<div class="
ui
unstackable
segment
">
<a class="
ui
blue
left
ribbon
label
">Senarai Notes</a>
<a href="
{{
route
(
'timesheet::form.penambahannote'
)
}}
" class="
ui
right
floated
small
purple
labeled
icon
button
">
<i class="
plus
icon
"></i>Upload Attachment
</a>
<a href="
{{
route
(
'timesheet::form.penambahannote'
)
}}
" class="
ui
right
floated
small
yellow
labeled
icon
button
">
<i class="
plus
icon
"></i>Add New Notes
</a><br>
kalau user dept bdd, display upload files.
<!-- <form action="">
<label for="
uploadfile
" class="
ui
right
floated
small
purple
labeled
icon
button
">
<i class="
plus
icon
"></i>Upload Attachment
</label>
<input type="
file
" name="
attachment
" id="
uploadfile
" style="
display
:
none
;
">
</form> -->
<button class="
ui
right
floated
small
purple
labeled
icon
button
" id="
uploadmodal
">
<i class="
file
icon
"></i>
Upload File
</button>
<a href="
{{
route
(
'timesheet::form.penambahannote'
)
}}
" class="
ui
right
floated
small
yellow
labeled
icon
button
">
<i class="
plus
icon
"></i>Add New Notes
</a><br><br>
<table class="
ui
celled
padded
table
">
<thead>
<tr>
...
...
@@ -30,9 +60,7 @@
@endforeach
</tbody>
</table>
<form action="">
<input type="
file
" name="
attachment
">
</form><br>
<button class="
center
aligned
ui
teal
compact
labeled
icon
button
" onclick="
window
.
location
.
href
=
'{{ route('
timesheet
::
form
.
overheadForm
', ['
phase
' => $phase, '
month
' => $month]) }}'
;
">
<i class="
angle
double
left
icon
"></i>
Overhead Form
...
...
@@ -44,3 +72,23 @@
</div>
@endsection
@push('script')
<script>
$(function(){
$("
#uploadmodal").click(function()
{
$
(
".uploadmodal"
)
.
modal
(
'show'
);
});
$
(
".uploadmodal"
)
.
modal
(
{
closable
:
true
});
$
(
".uploadmodal"
)
.
modal
(
'attach events'
,
'.close.button'
);
});
</
script
>
@
endpush
\ No newline at end of file
packages/portal/timesheet/routes/web.php
View file @
b2733f9f
...
...
@@ -70,6 +70,7 @@ Route::group(
Route
::
post
(
'nonchargeableselectmonthphase'
,
[
'uses'
=>
'FormController@nonchargeableselectmonthphase'
,
'as'
=>
'form.nonchargeableselectmonthphase'
]);
Route
::
post
(
'overheadselectmonthphase'
,
[
'uses'
=>
'FormController@overheadselectmonthphase'
,
'as'
=>
'form.overheadselectmonthphase'
]);
Route
::
post
(
'noteselectmonthphase'
,
[
'uses'
=>
'FormController@noteselectmonthphase'
,
'as'
=>
'form.noteselectmonthphase'
]);
Route
::
post
(
'action/upload'
,
[
'uses'
=>
'FormController@uploadAttachement'
,
'as'
=>
'form.upload'
]);
// nonChargeableForm
Route
::
post
(
'addnonchargeabletask'
,[
'uses'
=>
'FormController@addnonchargeabletask'
,
'as'
=>
'form.addnonchargeabletask'
]);
...
...
packages/portal/timesheet/src/Http/Controllers/DashboardController.php
View file @
b2733f9f
...
...
@@ -321,7 +321,9 @@ class DashboardController extends Controller
->
where
(
'tm_year'
,
$year
)
->
where
(
'tm_month'
,
$month
)
->
where
(
'tm_phase'
,
$phase
)
->
with
(
'attachement'
)
->
first
();
if
(
$check
)
{
...
...
packages/portal/timesheet/src/Http/Controllers/FormController.php
View file @
b2733f9f
...
...
@@ -24,6 +24,8 @@ use App\Mail\StatusReject;
use
Mail
;
use
Curl
;
use
Auth
;
use
Portal\Timesheet\Model\NotesAttachement
;
class
FormController
extends
Controller
{
...
...
@@ -1100,4 +1102,77 @@ class FormController extends Controller
return
redirect
()
->
route
(
'timesheet::form.notelist'
,
[
'year'
=>
$data
->
tm_year
,
'month'
=>
$data
->
tm_month
,
'phase'
=>
$data
->
tm_phase
,
'fk_tm_id'
=>
$data
->
fk_tm_id
])
->
with
(
'success'
,
'Note Added'
);;
}
/**
* undocumented function
*
* @return void
* @author
**/
public
function
uploadAttachement
(
Request
$request
)
{
// dd($request->attachment);
$check
=
NotesAttachement
::
where
(
'fk_timesheet_master'
,
$request
->
id
)
->
first
();
$folder
=
"notes"
;
$date
=
date
(
'Ymd'
);
$id
=
$request
->
id
;
$files
=
$request
->
attachment
;
if
(
!
file_exists
(
public_path
()
.
'/uploads'
))
{
mkdir
(
public_path
()
.
"/uploads"
);
}
if
(
!
file_exists
(
public_path
()
.
'/uploads/timesheet'
))
{
mkdir
(
public_path
()
.
"/uploads/timesheet"
);
}
if
(
!
file_exists
(
public_path
()
.
'/uploads/timesheet/'
.
$folder
))
{
mkdir
(
public_path
()
.
"/uploads/timesheet/"
.
$folder
);
}
if
(
!
file_exists
(
public_path
()
.
'/uploads/timesheet/notes/'
.
$id
))
{
mkdir
(
public_path
()
.
"/uploads/timesheet/notes/"
.
$id
);
}
$path
=
public_path
()
.
"/uploads/timesheet/notes/"
.
$id
;
$filename
=
$files
->
getClientOriginalName
();
$shortpath
=
"/uploads/timesheet/notes/"
.
$id
.
"/"
.
$filename
;
// $photo->move($path, $photo->getClientOriginalName());
$filename
=
$files
->
getClientOriginalName
();
$extension
=
$files
->
getClientOriginalExtension
();
$size
=
$files
->
getSize
();
$files
->
move
(
$path
,
$files
->
getClientOriginalName
());
if
(
$check
){
$upd
=
NotesAttachement
::
where
(
'fk_timesheet_master'
,
$request
->
id
)
->
first
();
// $upd->fk_timesheet_master = $request->id;
$upd
->
path
=
$shortpath
;
$upd
->
save
();
}
else
{
$upd
=
new
NotesAttachement
;
$upd
->
fk_timesheet_master
=
$request
->
id
;
$upd
->
path
=
$shortpath
;
$upd
->
save
();
}
return
redirect
()
->
back
()
->
withSuccess
(
'Berjaya mengemaskini attachment'
);
}
}
\ No newline at end of file
packages/portal/timesheet/src/Model/NotesAttachement.php
0 → 100644
View file @
b2733f9f
<?php
namespace
Portal\Timesheet\Model
;
use
Illuminate\Database\Eloquent\Model
;
class
NotesAttachement
extends
Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected
$table
=
'notes_attachement'
;
/**
* undocumented function
*
* @return void
* @author
**/
public
function
timesheet
()
{
return
$this
->
belongsTo
(
'Portal\Timesheet\Model\ts_master'
,
'fk_timesheet_master'
,
'id'
);
}
}
packages/portal/timesheet/src/Model/ts_master.php
View file @
b2733f9f
...
...
@@ -24,9 +24,9 @@ class Ts_master extends Model
* @return void
* @author
**/
public
function
info
()
public
function
attachement
()
{
return
$this
->
hasOne
(
'Portal\Timesheet\Model\NotesAttachement'
,
'fk_timesheet_master'
,
'id'
);
}
...
...
public/uploads/timesheet/notes/7/5S trail.jpg
0 → 100644
View file @
b2733f9f
146 KB
public/uploads/timesheet/notes/7/Hannan.jpeg
0 → 100644
View file @
b2733f9f
55.9 KB
public/uploads/timesheet/notes/7/WhatsApp Image 2021-07-03 at 3.05.40 PM.jpeg
0 → 100644
View file @
b2733f9f
26 KB
public/uploads/timesheet/notes/7/site visit.JPG
0 → 100644
View file @
b2733f9f
60.5 KB
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