Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
webprofile-jwg2024
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
Siti Aisah
webprofile-jwg2024
Commits
d7b27148
Commit
d7b27148
authored
Jul 06, 2022
by
Siti Aisah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update fitur edit agenda untuk auto translate dan manual
parent
b1f1e29c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
357 additions
and
14 deletions
+357
-14
app/Http/Controllers/Webprofile/Backend/AgendaController.php
+90
-11
app/Repositories/Webprofile/AgendaRepository.php
+3
-1
resources/views/webprofile/backend/agendas/edit.blade.php
+3
-2
resources/views/webprofile/backend/agendas/edit_per_bahasa.blade.php
+260
-0
routes/webprofile/backend.php
+1
-0
No files found.
app/Http/Controllers/Webprofile/Backend/AgendaController.php
View file @
d7b27148
...
...
@@ -189,15 +189,36 @@ class AgendaController extends Controller
*/
public
function
edit
(
$id
)
{
$setting
=
webprofilesetting
();
$data
=
$this
->
repo
->
findId
(
$id
,
[
'rEn'
,
'rDe'
,
'rSa'
,
'rZh'
]);
$categories
=
Categories
::
pluck
(
'name'
,
'id'
);
$manual
=
0
;
$data
=
[
'data'
=>
$data
,
'categories'
=>
$categories
,
'setting'
=>
$setting
,
'manual'
=>
$manual
,
];
return
view
(
'webprofile.backend.agendas.edit'
,
$data
)
->
withTitle
(
trans
(
'feature.edit_agenda'
));
}
public
function
editPerBahasa
(
$id
)
{
$setting
=
webprofilesetting
();
$data
=
$this
->
repo
->
findId
(
$id
,
[
'rEn'
,
'rDe'
,
'rSa'
,
'rZh'
]);
$categories
=
Categories
::
pluck
(
'name'
,
'id'
);
$manual
=
1
;
$data
=
[
'data'
=>
$data
,
'categories'
=>
$categories
,
'setting'
=>
$setting
,
'manual'
=>
$manual
,
];
return
view
(
'webprofile.backend.agendas.edit_per_bahasa'
,
$data
)
->
withTitle
(
trans
(
'feature.edit_agenda'
));
}
/**
...
...
@@ -209,52 +230,110 @@ class AgendaController extends Controller
*/
public
function
update
(
Request
$request
,
$id
)
{
$data
=
$request
->
except
([
'_token'
,
'id'
,
'title_en'
,
'content_en'
,
'title_de'
,
'content_de'
,
'title_sa'
,
'content_sa'
,
'title_zh'
,
'content_zh'
]);
$dataEn
=
$request
->
except
([
'_token'
,
'id'
]);
$data
=
$request
->
except
([
'_token'
,
'
manual'
,
'
id'
,
'title_en'
,
'content_en'
,
'title_de'
,
'content_de'
,
'title_sa'
,
'content_sa'
,
'title_zh'
,
'content_zh'
]);
$dataEn
=
$request
->
except
([
'_token'
,
'id'
,
'manual'
]);
array_key_exists
(
'info_status'
,
$data
)
?
$data
[
'info_status'
]
=
1
:
$data
[
'info_status'
]
=
0
;
$data
[
'slug'
]
=
str_slug
(
$request
->
input
(
'title'
));
$agenda
=
$this
->
repo
->
findId
(
$id
,
[
'rEn'
,
'rDe'
,
'rSa'
,
'rZh'
]);
$edit
=
$this
->
repo
->
update
(
$data
,
$agenda
);
$this
->
updateEn
(
$dataEn
,
$agenda
);
$this
->
updateDe
(
$dataEn
,
$agenda
);
$this
->
updateSa
(
$dataEn
,
$agenda
);
$this
->
updateZh
(
$dataEn
,
$agenda
);
$this
->
updateEn
(
$dataEn
,
$agenda
,
$request
->
manual
);
$this
->
updateDe
(
$dataEn
,
$agenda
,
$request
->
manual
);
$this
->
updateSa
(
$dataEn
,
$agenda
,
$request
->
manual
);
$this
->
updateZh
(
$dataEn
,
$agenda
,
$request
->
manual
);
$this
->
repo
->
update
(
$data
,
$agenda
);
return
redirect
()
->
route
(
'agendas.index'
);
}
public
function
updateEn
(
$data
,
$agenda
)
public
function
updateEn
(
$data
,
$agenda
,
$manual
)
{
if
(
$manual
==
1
)
{
$dataEn
[
'title'
]
=
$data
[
'title_en'
];
$dataEn
[
'content'
]
=
$data
[
'content_en'
];
}
else
{
if
(
strip_tags
(
$data
[
'content'
])
==
null
)
{
$data
[
'content'
]
=
'kosong'
;
}
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
$data
[
'title'
]);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
strip_tags
(
$data
[
'content'
]));
$dataEn
[
'title'
]
=
$title
;
$dataEn
[
'content'
]
=
$content
;
}
$this
->
repoEn
->
update
(
$dataEn
,
$agenda
);
}
public
function
updateDe
(
$data
,
$agenda
)
public
function
updateDe
(
$data
,
$agenda
,
$manual
)
{
if
(
$manual
==
1
)
{
$dataDe
[
'title'
]
=
$data
[
'title_de'
];
$dataDe
[
'content'
]
=
$data
[
'content_de'
];
}
else
{
if
(
strip_tags
(
$data
[
'content'
])
==
null
)
{
$data
[
'content'
]
=
'kosong'
;
}
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETDE
,
$data
[
'title'
]);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETDE
,
strip_tags
(
$data
[
'content'
]));
$dataDe
[
'title'
]
=
$title
;
$dataDe
[
'content'
]
=
$content
;
}
$this
->
repoDe
->
update
(
$dataDe
,
$agenda
);
}
public
function
updateSa
(
$data
,
$agenda
)
public
function
updateSa
(
$data
,
$agenda
,
$manual
)
{
if
(
$manual
==
1
)
{
$dataSa
[
'title'
]
=
$data
[
'title_sa'
];
$dataSa
[
'content'
]
=
$data
[
'content_sa'
];
}
else
{
if
(
strip_tags
(
$data
[
'content'
])
==
null
)
{
$data
[
'content'
]
=
'kosong'
;
}
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETSA
,
$data
[
'title'
]);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETSA
,
strip_tags
(
$data
[
'content'
]));
$dataSa
[
'title'
]
=
$title
;
$dataSa
[
'content'
]
=
$content
;
}
$this
->
repoSa
->
update
(
$dataSa
,
$agenda
);
}
public
function
updateZh
(
$data
,
$agenda
)
public
function
updateZh
(
$data
,
$agenda
,
$manual
)
{
if
(
$manual
==
1
)
{
$dataZh
[
'title'
]
=
$data
[
'title_zh'
];
$dataZh
[
'content'
]
=
$data
[
'content_zh'
];
}
else
{
if
(
strip_tags
(
$data
[
'content'
])
==
null
)
{
$data
[
'content'
]
=
'kosong'
;
}
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETZH
,
$data
[
'title'
]);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETZH
,
strip_tags
(
$data
[
'content'
]));
$dataZh
[
'title'
]
=
$title
;
$dataZh
[
'content'
]
=
$content
;
}
$this
->
repoZh
->
update
(
$dataZh
,
$agenda
);
}
...
...
app/Repositories/Webprofile/AgendaRepository.php
View file @
d7b27148
...
...
@@ -35,7 +35,9 @@ class AgendaRepository extends Repository
return
DataTables
::
of
(
$data
)
->
addIndexColumn
()
->
addColumn
(
'action'
,
function
(
$row
)
{
$btn
=
'<a href="'
.
url
(
'/webprofile/agendas/'
.
$row
->
id
.
'/edit'
)
.
'" data-toggle="tooltip" data-id="'
.
$row
->
id
.
'" data-original-title="'
.
trans
(
'label.edit'
)
.
'" class="edit btn btn-warning btn-round btn-sm edit">'
.
trans
(
'label.edit'
)
.
'</a>'
;
$btn
=
'<a href="'
.
url
(
'/webprofile/agendas/'
.
$row
->
id
.
'/edit'
)
.
'" data-toggle="tooltip" data-id="'
.
$row
->
id
.
'" data-original-title="'
.
trans
(
'label.editsemuabahasa'
)
.
'" class="edit btn btn-warning btn-round btn-sm edit">'
.
trans
(
'label.editsemuabahasa'
)
.
'</a>'
;
$btn
=
$btn
.
'<a href="'
.
url
(
'/webprofile/agendas/'
.
$row
->
id
.
'/editperbahasa'
)
.
'" data-toggle="tooltip" data-id="'
.
$row
->
id
.
'" data-original-title="'
.
trans
(
'label.edittiapbahasa'
)
.
'" class="edit btn btn-warning btn-round btn-sm edit">'
.
trans
(
'label.edittiapbahasa'
)
.
'</a>'
;
$btn
=
$btn
.
' <a href="javascript:void(0)" data-toggle="tooltip" data-id="'
.
$row
->
id
.
'" data-original-title="'
.
trans
(
'label.delete'
)
.
'" class="btn btn-danger btn-round btn-sm delete">'
.
trans
(
'label.delete'
)
.
'</a>'
;
...
...
resources/views/webprofile/backend/agendas/edit.blade.php
View file @
d7b27148
...
...
@@ -46,10 +46,11 @@
<div class="
col
-
md
-
12
">
<div class="
block
">
{{ Form::textarea('content', null, array('id'=>'content')) }}
{{ Form::hidden('manual',
$manual
, array('id'=>'manual')) }}
</div>
</div>
</div>
<div class="
tabs
">
{{--
<div class="
tabs
">
<ul class="
nav
nav
-
tabs
" role="
tablist
">
<li class="
active
"><a href="
#inggris" role="tab" data-toggle="tab" aria-expanded="true">Inggris</a></li>
<
li
class
=""><
a
href
=
"#jerman"
role
=
"tab"
data
-
toggle
=
"tab"
aria
-
expanded
=
"false"
>
Jerman
</
a
></
li
>
...
...
@@ -138,7 +139,7 @@
</div>
</div>
</div>
</div>
</div>
--}}
</div>
</div>
</div>
...
...
resources/views/webprofile/backend/agendas/edit_per_bahasa.blade.php
0 → 100644
View file @
d7b27148
@
extends
(
'webprofile.backend.layouts.master'
)
@
section
(
'title'
)
{{
$title
}}
@
stop
@
section
(
'assets'
)
<
link
rel
=
"stylesheet"
href
=
"{!! asset('backend/assets/select2/select2.min.css') !!}"
>
<
style
media
=
"screen"
>
.
tkh
{
color
:
black
;
}
</
style
>
@
stop
@
section
(
'breadcrumbs'
)
<
li
><
a
href
=
"{{ url('dashboard') }}"
>@
lang
(
'label.dashboard'
)
</
a
></
li
>
<
li
class
="
active
">@lang('feature.create_agenda')</li>
@stop
@section('content')
<!-- page start-->
<div class="
row
">
{!! Form::model(
$data
, ['route' => ['agendas.update',
$data->id
], 'method'=>'patch', 'files' => true]) !!}
{!! csrf_field() !!}
<div class="
col
-
md
-
9
">
<div class="
panel
panel
-
default
">
<div class="
panel
-
heading
">
<h3 class="
panel
-
title
"><strong>@lang('label.create')</strong> @lang('feature.page')</h3>
</div>
<div class="
panel
-
body
">
<div class="
row
">
<div style="
padding
:
10
px
10
px
10
px
10
px
;
font
-
weight
:
bold
;
font
-
size
:
14
pt
;
">
Bahasa Indonesia
</div>
<div class="
col
-
md
-
12
">
<div class="
form
-
group
@
if
(
$errors
->
has
(
'title'
))
has
-
error
@
endif
">
<div class="
col
-
md
-
12
">
{{ Form::text('title', old('title'), array('class' => 'form-control', 'placeholder'=>app('translator')->getFromJson('label.title'), 'style'=>'font-size: 14pt;', 'required')) }}
@if (
$errors->has
('title'))
<label id="
login
-
error
" class="
error
" for="
login
">
{
{$errors->first('title')}
}
</label>
@endif
</div>
</div>
</div>
<div class="
col
-
md
-
12
">
<div class="
block
">
{{ Form::textarea('content', null, array('id'=>'content')) }}
{{ Form::hidden('manual',
$manual
, array('id'=>'manual')) }}
</div>
</div>
</div>
<div class="
tabs
">
<ul class="
nav
nav
-
tabs
" role="
tablist
">
<li class="
active
"><a href="
#inggris" role="tab" data-toggle="tab" aria-expanded="true">Inggris</a></li>
<
li
class
=""><
a
href
=
"#jerman"
role
=
"tab"
data
-
toggle
=
"tab"
aria
-
expanded
=
"false"
>
Jerman
</
a
></
li
>
<
li
class
=""><
a
href
=
"#arab"
role
=
"tab"
data
-
toggle
=
"tab"
aria
-
expanded
=
"false"
>
Arab
</
a
></
li
>
<
li
class
=""><
a
href
=
"#cina"
role
=
"tab"
data
-
toggle
=
"tab"
aria
-
expanded
=
"false"
>
Cina
</
a
></
li
>
</
ul
>
<
div
class
="
tab
-
content
">
<div class="
tab
-
pane
active
" id="
inggris
">
<div style="
padding
:
10
px
10
px
10
px
10
px
;
font
-
weight
:
bold
;
font
-
size
:
14
pt
;
">
English Language
</div>
<div class="
col
-
md
-
12
">
<div class="
form
-
group
@
if
(
$errors
->
has
(
'title'
))
has
-
error
@
endif
">
<div class="
col
-
md
-
12
">
{{ Form::text('title_en',
$data->rEn
?
$data->rEn
->title : null, array('class' => 'form-control', 'placeholder'=>app('translator')->getFromJson('label.title'), 'style'=>'font-size: 14pt;', 'required')) }}
@if (
$errors->has
('title'))
<label id="
login
-
error
" class="
error
" for="
login
">
{
{$errors->first('title')}
}
</label>
@endif
</div>
</div>
</div>
<div class="
col
-
md
-
12
">
<div class="
block
">
{{ Form::textarea('content_en',
$data->rEn
?
$data->rEn
->content : null, array('id'=>'content_en')) }}
</div>
</div>
</div>
<div class="
tab
-
pane
" id="
jerman
">
<div style="
padding
:
10
px
10
px
10
px
10
px
;
font
-
weight
:
bold
;
font
-
size
:
14
pt
;
">
deutsche Sprache
</div>
<div class="
col
-
md
-
12
">
<div class="
form
-
group
@
if
(
$errors
->
has
(
'title'
))
has
-
error
@
endif
">
<div class="
col
-
md
-
12
">
{{ Form::text('title_de',
$data->rDe
?
$data->rDe
->title : null, array('class' => 'form-control', 'placeholder'=>app('translator')->getFromJson('label.title'), 'style'=>'font-size: 14pt;')) }}
@if (
$errors->has
('title'))
<label id="
login
-
error
" class="
error
" for="
login
">
{
{$errors->first('title')}
}
</label>
@endif
</div>
</div>
</div>
<div class="
col
-
md
-
12
">
<div class="
block
">
{{ Form::textarea('content_de',
$data->rDe
?
$data->rDe
->content : null, array('id'=>'content_de')) }}
</div>
</div>
</div>
<div class="
tab
-
pane
" id="
arab
">
<div style="
padding
:
10
px
10
px
10
px
10
px
;
font
-
weight
:
bold
;
font
-
size
:
14
pt
;
">
اللغة العربية
</div>
<div class="
col
-
md
-
12
">
<div class="
form
-
group
@
if
(
$errors
->
has
(
'title'
))
has
-
error
@
endif
">
<div class="
col
-
md
-
12
">
{{ Form::text('title_sa',
$data->rSa
?
$data->rSa
->title : null, array('class' => 'form-control', 'placeholder'=>app('translator')->getFromJson('label.title'), 'style'=>'font-size: 14pt;')) }}
@if (
$errors->has
('title'))
<label id="
login
-
error
" class="
error
" for="
login
">
{
{$errors->first('title')}
}
</label>
@endif
</div>
</div>
</div>
<div class="
col
-
md
-
12
">
<div class="
block
">
{{ Form::textarea('content_sa',
$data->rSa
?
$data->rSa
->content : null, array('id'=>'content_sa')) }}
</div>
</div>
</div>
<div class="
tab
-
pane
" id="
cina
">
<div style="
padding
:
10
px
10
px
10
px
10
px
;
font
-
weight
:
bold
;
font
-
size
:
14
pt
;
">
中文
</div>
<div class="
col
-
md
-
12
">
<div class="
form
-
group
@
if
(
$errors
->
has
(
'title'
))
has
-
error
@
endif
">
<div class="
col
-
md
-
12
">
{{ Form::text('title_zh',
$data->rZh
?
$data->rZh
->title : null, array('class' => 'form-control', 'placeholder'=>app('translator')->getFromJson('label.title'), 'style'=>'font-size: 14pt;')) }}
@if (
$errors->has
('title'))
<label id="
login
-
error
" class="
error
" for="
login
">
{
{$errors->first('title')}
}
</label>
@endif
</div>
</div>
</div>
<div class="
col
-
md
-
12
">
<div class="
block
">
{{ Form::textarea('content_zh',
$data->rZh
?
$data->rZh
->content : null, array('id'=>'content_zh')) }}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="
col
-
md
-
3
">
<div class="
panel
panel
-
default
">
<div class="
panel
-
heading
">
<h3 class="
panel
-
title
"><strong>@lang('label.event_date')</strong></h3>
<ul class="
panel
-
controls
">
<li><a href="
#" class="panel-collapse"><span class="fa fa-angle-down"></span></a></li>
</
ul
>
</
div
>
<
div
class
="
panel
-
body
">
<div class="
row
">
<div class="
col
-
md
-
12
">
<div class="
form
-
group
">
<label class="
col
-
md
-
3
col
-
xs
-
12
control
-
label
">@lang('label.date')</label>
<div class="
col
-
md
-
12
">
<div class="
input
-
group
">
{{ Form::text('event_date', null, array('class' => 'form-control datepicker')) }}
</div>
</div>
</div>
</div>
<div class="
col
-
md
-
12
">
<div class="
form
-
group
" style="
padding
-
top
:
10
px
;
">
<label class="
col
-
md
-
2
control
-
label
">@lang('label.status')</label>
<div class="
col
-
md
-
6
">
<center><label class="
switch
">
{{ Form::checkbox('info_status', null, null) }}
<span></span>
</label></center>
</div>
</div>
</div>
</div>
</div>
<div class="
panel
-
footer
">
</div>
</div>
</div>
<div class="
col
-
md
-
3
">
<div class="
panel
panel
-
default
">
<div class="
panel
-
footer
">
<button class="
btn
btn
-
info
pull
-
right
">@lang('label.save')</button>
</div>
</div>
</div>
<div class="
col
-
md
-
12
">
<div class="
panel
panel
-
default
">
<div class="
panel
-
heading
">
<h3 class="
panel
-
title
">Keywords</h3>
<ul class="
panel
-
controls
">
<li><a href="
#" class="panel-collapse"><span class="fa fa-angle-down"></span></a></li>
</
ul
>
</
div
>
<
div
class
="
panel
-
body
">
<div class="
row
">
<div class="
col
-
md
-
12
">
<div class="
form
-
group
@
if
(
$errors
->
has
(
'keys'
))
has
-
error
@
endif
">
<div class="
col
-
md
-
12
">
{{ Form::text('keys', old('keys'), array('class' => 'form-control', 'placeholder'=>app('translator')->getFromJson('label.keys'), 'style'=>'font-size: 14pt;')) }}
@if (
$errors->has
('keys'))
<label id="
login
-
error
" class="
error
" for="
login
">
{
{$errors->first('keys')}
}
</label>
@endif
</div>
</div>
</div>
</div>
</div>
<div class="
panel
-
footer
">
</div>
</div>
</div>
{!! Form::close() !!}
</div>
<!-- page end-->
@stop
@section('script')
{!! Html::script('backend/assets/select2/select2.full.min.js') !!}
{!! Html::script('backend/js/plugins/bootstrap/bootstrap-datepicker.js') !!}
{!! Html::script('backend/js/plugins/bootstrap/bootstrap-timepicker.min.js') !!}
{!! Html::script('backend/js/plugins/bootstrap/bootstrap-file-input.js') !!}
{!! Html::script('backend/js/plugins/summernote/summernote.js') !!}
<script type="
text
/
javascript
">
function PreviewImage() {
var oFReader = new FileReader();
oFReader.readAsDataURL(document.getElementById("
uploadImage
").files[0]);
oFReader.onload = function (oFREvent) {
document.getElementById("
uploadPreview
").src = oFREvent.target.result;
};
};
$(document).ready(function() {
$('#content').summernote({
height: 350
});
$('#content_en').summernote({
height: 350
});
$('#content_de').summernote({
height: 350
});
$('#content_sa').summernote({
height: 350
});
$('#content_zh').summernote({
height: 350
});
});
</script>
@stop
routes/webprofile/backend.php
View file @
d7b27148
...
...
@@ -21,6 +21,7 @@ Route::group(['middleware' => 'auth'], function () {
Route
::
get
(
'posts/{id}/editperbahasa'
,
'PostController@editperbahasa'
);
Route
::
resource
(
'posts'
,
'PostController'
);
Route
::
resource
(
'pages'
,
'PageController'
);
Route
::
get
(
'agendas/{id}/editperbahasa'
,
'AgendaController@editperbahasa'
);
Route
::
resource
(
'agendas'
,
'AgendaController'
);
Route
::
resource
(
'informations'
,
'InformationController'
);
Route
::
resource
(
'settings'
,
'SettingController'
);
...
...
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