File tree Expand file tree Collapse file tree 6 files changed +41
-6
lines changed Expand file tree Collapse file tree 6 files changed +41
-6
lines changed Original file line number Diff line number Diff line change @@ -192,7 +192,10 @@ function attachments(Request $request){
192
192
$ tmp = DB ::table ('settings ' )->where (['key ' => 'uploadpath ' ])->get ();
193
193
194
194
if (!count ($ tmp )){
195
- return false ;
195
+ if ($ request ->role == 'admin ' ){
196
+ return json_encode (['error ' => 'File upload path is not set ' ]);
197
+ }
198
+ return json_encode (['error ' => 'File upload Failed ' ]);
196
199
}
197
200
198
201
$ uploadpath = $ tmp [0 ]->value ;
Original file line number Diff line number Diff line change @@ -338,3 +338,15 @@ function setSelectedCount(){
338
338
}
339
339
340
340
setSelectedCount ( ) ;
341
+
342
+ gfunc = null ;
343
+
344
+ $ ( '#alert-ok' ) . on ( 'click' , function ( ) {
345
+ gfunc ( ) ;
346
+ } ) ;
347
+
348
+ function kchat_alert ( body , func ) {
349
+ $ ( "#alertbody" ) . html ( body ) ;
350
+ $ ( "#alertmodel" ) . click ( ) ;
351
+ gfunc = func ;
352
+ }
Original file line number Diff line number Diff line change @@ -427,16 +427,17 @@ $(document).ready (function(){
427
427
Data . append ( 'files[]' , files [ i ] ) ;
428
428
}
429
429
430
- //console.log(Data);
431
-
432
430
$ . ajax ( {
433
431
type : "POST" ,
434
432
url : '/messages/attachments' ,
435
433
data : Data ,
436
434
processData : false ,
437
435
contentType : false ,
438
436
success : function ( result ) {
439
- console . log ( result ) ;
437
+ result = $ . parseJSON ( result ) ;
438
+ if ( result . error != undefined ) {
439
+ kchat_alert ( result . error , ( function ( ) { } ) ) ;
440
+ }
440
441
} ,
441
442
error : function ( result ) {
442
443
Original file line number Diff line number Diff line change 62
62
</div >
63
63
</div >
64
64
</div >
65
+ <!-- Alert Modal -->
66
+ <input type =" hidden" id =" alertmodel" data-toggle =" modal" data-target =" #alert-model" />
67
+ <div class =" modal fade" id =" alert-model" tabindex =" -1" role =" dialog" aria-labelledby =" alertModel" aria-hidden =" true" >
68
+ <div class =" modal-dialog modal-dialog-centered" role =" document" >
69
+ <div class =" modal-content" >
70
+ <div class =" modal-header" >
71
+ <h5 class =" modal-title" >Alert</h5 >
72
+ <button type =" button" class =" close" data-dismiss =" modal" aria-label =" Close" >
73
+ <span aria-hidden =" true" >× ; </span >
74
+ </button >
75
+ </div >
76
+ <p class =" p-3" id =" alertbody" ></p >
77
+ <div class =" modal-footer" >
78
+ <button type =" button" id =" alert-ok" class =" btn btn-secondary" data-dismiss =" modal" >Ok</button >
79
+ <button type =" button" class =" btn btn-secondary" data-dismiss =" modal" >Close</button >
80
+ </div >
81
+ </div >
82
+ </div >
83
+ </div >
65
84
@yield (' script' )
66
85
<script src =" /js/kchat.js" ></script >
67
86
@yield (' javascript' )
Original file line number Diff line number Diff line change 212
212
@endsection
213
213
214
214
@section (' script' )
215
-
215
+ <!-- No Script -->
216
216
@endsection
Original file line number Diff line number Diff line change 46
46
</div >
47
47
</div >
48
48
<div class =" chat-history" id =" Msgs" style =" min-height : 50% ;" >
49
- <image id =" loading" src =" /assets/loading.gif" ></ image >
49
+ <image id =" loading" src =" /assets/loading.gif" / >
50
50
<ul class =" pl-3 pr-3" id =" Messages" ></ul >
51
51
<button type =" button" id =" gotobottom" class =" btn btn-outline-secondary" ><i class =" fa fa-chevron-down" ></i ></button >
52
52
</div >
You can’t perform that action at this time.
0 commit comments