Last active
August 29, 2015 14:24
-
-
Save phanngoc/01b450bd186bd3ae0579 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @extends ('layouts.master') | |
| @section ('head.title') | |
| {{trans('messages.list_user')}} | |
| @stop | |
| @section ('head.css') | |
| <link href="plugins/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" /> | |
| <link rel="stylesheet" type="text/css" href="{{ Asset('jquery-ui/jquery-ui.css') }}" /> | |
| <link rel="stylesheet" type="text/css" href="{{ Asset('jquery-ui/jquery-ui.theme.css') }}" /> | |
| <link rel="stylesheet" type="text/css" href="{{ Asset('jquery-ui/jquery-ui.structure.css') }}" /> | |
| <script type="text/javascript" src="{{ Asset('jquery-ui/jquery-ui.js') }}"></script> | |
| @stop | |
| @section ('body.content') | |
| <link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" /> | |
| <script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js"></script> | |
| <div class="content-wrapper"> | |
| <script type="text/javascript" src="{{ Asset('jqueryvalidate/jquery.validate.js') }}"></script> | |
| <section class="content-header"> | |
| <h1> | |
| {{trans('messages.device_manager')}} | |
| </h1> | |
| <ol class="breadcrumb"> | |
| <li><a href="{{ route('index') }}"><i class="fa fa-dashboard"></i> {{trans('messages.dashboard')}}</a></li> | |
| <li><a href="{{ route('employee') }}">{{trans('messages.device')}}</a></li> | |
| <li class="active">{{trans('messages.borrow_device')}}</li> | |
| </ol> | |
| </section> | |
| <!-- Main content --> | |
| <section class="content"> | |
| <div class="row"> | |
| <div class="col-xs-12"> | |
| <div class="box box-primary"> | |
| <div class="box-header"> | |
| <h3 class="box-title">{{trans('messages.borrow_device')}}</h3> | |
| </div> | |
| <div class="alert alert-success notifi"> | |
| <h4 style="text-align:center;"></h4> | |
| </div> | |
| <div class="row"> | |
| </div> | |
| <div class="box-body"> | |
| <table id="example1" class="table table-bordered table-hover"> | |
| <thead> | |
| <tr> | |
| <th style="width: 5%" class="text-center">#</th> | |
| <th class="text-center">Name Device</th> | |
| <th class="text-center">Serial Device</th> | |
| <th class="text-center">Receive Date</th> | |
| <th class="text-center">Return Date</th> | |
| <th class="text-center">Status</th> | |
| <th class="text-center">Assignted To</th> | |
| <th style="width: 10%" class="text-center">{{trans('messages.actions')}}</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <?php | |
| $index = 1; | |
| foreach ($devices as $key => $value) : ?> | |
| <tr> | |
| <input type="hidden" name="id" value="{{ $value->id }}"/> | |
| <td><?php echo $index; $index++; ?></td> | |
| <td>{{ $value->kind_device()->first()->device_name }}</td> | |
| <td>{{ $value->serial_device }}</td> | |
| <td><p style="display:none">{{ $value->receive_date }}</p><input value="{{ $value->receive_date }}" class="receive_date"/></td> | |
| <td><p style="display:none">{{ $value->return_date }}</p><input value="{{ $value->return_date }}" class="return_date"/></td> | |
| <td>{!! Form::select('status_id',$statusall,$value->status_devices()->first()->id, ['class'=>'js-example-basic-multiple form-control']) !!}</td> | |
| <td> | |
| {!! Form::select('employee_id',$employall,$value->employee_id, ['class'=>'js-example-basic-multiple form-control']) !!} | |
| </td> | |
| <td> | |
| <div class="text-blue accept itemaction" title="Edit"> | |
| <i class="fa fa-fw fa-floppy-o"></i> | |
| </div> | |
| <!-- <div class="text-blue refresh itemaction" title="Refresh"> | |
| <i class="fa fa-fw fa-refresh"></i> | |
| </div> --> | |
| </td> | |
| </tr> | |
| <?php endforeach; ?> | |
| </tbody> | |
| </table> | |
| </div> | |
| <!-- /.box-body --> | |
| </div> | |
| <!-- /.box --> | |
| </div> | |
| <!-- /.col --> | |
| </div> | |
| <!-- /.row --> | |
| </section> | |
| <!-- /.content --> | |
| </div> | |
| <style type="text/css"> | |
| .itemaction{ | |
| display: block; | |
| float: left; | |
| margin-left: 10px; | |
| } | |
| </style> | |
| <script type="text/javascript"> | |
| $(document).ready(function(){ | |
| $('.notifi').hide(); | |
| $(".js-example-basic-multiple").select2({placeholder: "Please enter your group"}); | |
| $(".receive_date").datepicker({dateFormat: "yy-mm-dd"}); | |
| $(".return_date").datepicker({dateFormat: "yy-mm-dd"}); | |
| $('.accept').click(function(){ | |
| var data = {}; | |
| data.id = $(this).parent().parent().find('input[name="id"]').val(); | |
| data.receive_date = $(this).parent().parent().find('.receive_date').val(); | |
| data.return_date = $(this).parent().parent().find('.return_date').val(); | |
| data.status_id = $(this).parent().parent().find('select[name="status_id"]').val(); | |
| data.employee_id = $(this).parent().parent().find('select[name="employee_id"]').val(); | |
| $.ajax({ | |
| url : '{{ route("saveborrowdevice") }}', | |
| type : 'POST', | |
| data : {data : data , _token :"{{ csrf_token() }}" } | |
| }).done(function(res){ | |
| $('.notifi h4').html("Save successfully"); | |
| $('.notifi').show().delay(3000).fadeOut(); | |
| }); | |
| }); | |
| $(".receive_date").change(function(){ | |
| var val = $(this).val(); | |
| $(this).parent().next().children('.return_date').datepicker('option', 'minDate', val); | |
| }); | |
| $(".receive_date").trigger("change"); | |
| $('select[name="employee_id"]').change(function(){ | |
| if($(this).val() == 0) | |
| { | |
| console.log('ok'); | |
| // $(this).parent().parent().find('select[name="status_id"]').find('option').removeAttr('selected'); | |
| // $(this).parent().parent().find('select[name="status_id"]').find('option[value="'+3+'"]').attr('selected','selected'); | |
| $(this).parent().parent().find('select[name="status_id"]').select2("val", 3); | |
| $(this).parent().parent().find('.receive_date').datepicker("setDate", "0000-00-00"); | |
| $(this).parent().parent().find('.return_date').datepicker("setDate", "0000-00-00"); | |
| } | |
| }); | |
| }); | |
| </script> | |
| @stop | |
| @section ('body.js') | |
| <script src="{{asset('plugins/datatables/jquery.dataTables.min.js')}}" type="text/javascript"></script> | |
| <script src="{{asset('plugins/datatables/dataTables.bootstrap.min.js')}}" type="text/javascript"></script> | |
| <script type="text/javascript"> | |
| $(function () { | |
| function lowcase(text) | |
| { | |
| if(text == "") return text; | |
| var res = text.toLowerCase(); | |
| return res; | |
| } | |
| var oTable = $('#example1').dataTable({ | |
| "bPaginate": true, | |
| "bLengthChange": false, | |
| "bFilter": true, | |
| "bSort": true, | |
| "bInfo": false, | |
| "bAutoWidth": false | |
| }); | |
| var dataobj = []; | |
| $('#example1 tbody tr').each(function(key,value){ | |
| var text_status = $(value).find('td:nth-child(7)').find(':selected').text(); | |
| var text_employee = $(value).find('td:nth-child(8)').find(':selected').text(); | |
| var text_receive_date = $(value).find('td:nth-child(5) input').val(); | |
| var text_return_date = $(value).find('td:nth-child(6) input').val(); | |
| dataobj.push({text_status : text_status,text_employee : text_employee ,text_receive_date : text_receive_date,text_return_date : text_return_date}); | |
| }); | |
| console.log(dataobj); | |
| $.fn.dataTable.ext.search.push( | |
| function( settings, data, dataIndex ) { | |
| //console.log(data); | |
| //var index = parseInt(data[0])-1; | |
| //var text_status = $('#example1 tbody tr').eq(dataIndex).find('td:nth-child(7)').find(':selected').text(); | |
| //var text_employee = $('#example1 tbody tr').eq(dataIndex).find('td:nth-child(8)').find(':selected').text(); | |
| // var text_date_receive = $('#example1 tbody tr').eq(dataIndex).find('td:nth-child(5) input').val(); | |
| // var text_date_return = $('#example1 tbody tr').eq(dataIndex).find('td:nth-child(6) input').val(); | |
| var text_status = dataobj[dataIndex].text_status; | |
| var text_employee = dataobj[dataIndex].text_employee; | |
| var text_receive_date = dataobj[dataIndex].text_receive_date; | |
| var text_return_date = dataobj[dataIndex].text_return_date; | |
| var input_sm = $('.input-sm').val(); | |
| console.log(input_sm); | |
| console.log(lowcase(text_receive_date)); | |
| console.log(lowcase(text_receive_date).indexOf(lowcase(input_sm))); | |
| // console.log(text_date_receive); | |
| if(lowcase(text_status).indexOf(lowcase(input_sm)) > -1 || lowcase(text_employee).indexOf(lowcase(input_sm)) > -1 || | |
| lowcase(data[1]).indexOf(lowcase(input_sm)) > -1 || lowcase(data[2]).indexOf(lowcase(input_sm)) > -1 | |
| || lowcase(text_receive_date).indexOf(lowcase(input_sm)) > -1 || lowcase(text_return_date).indexOf(lowcase(input_sm)) > -1 | |
| ) | |
| { | |
| return true; | |
| } | |
| return false; | |
| } | |
| ); | |
| }); | |
| </script> | |
| @stop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @extends ('layouts.master') | |
| @section ('head.title') | |
| {{trans('messages.list_user')}} | |
| @stop | |
| @section ('head.css') | |
| <link href="plugins/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" /> | |
| <link rel="stylesheet" type="text/css" href="{{ Asset('jquery-ui/jquery-ui.css') }}" /> | |
| <script type="text/javascript" src="{{ Asset('jquery-ui/jquery-ui.js') }}"></script> | |
| <link rel="stylesheet" type="text/css" href="{{ Asset('jquery-timepicker/jquery.timepicker.css') }}" /> | |
| <script type="text/javascript" src="{{ Asset('jquery-timepicker/jquery.timepicker.js') }}"></script> | |
| <style type="text/css"> | |
| .ui-widget-header { | |
| color : black; | |
| } | |
| span.select2-container--default,span.select2-container--below{ | |
| width: 192px !important; | |
| } | |
| </style> | |
| <script type="text/javascript"> | |
| $(document).ready(function(){ | |
| $('.ui-timepicker-input').timepicker({ 'timeFormat': 'g:ia','step': 15}); | |
| }); | |
| </script> | |
| @stop | |
| @section ('body.content') | |
| <link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" /> | |
| <script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js"></script> | |
| <div class="content-wrapper"> | |
| <script type="text/javascript" src="{{ Asset('jqueryvalidate/jquery.validate.js') }}"></script> | |
| <section class="content-header"> | |
| <h1> | |
| {{trans('messages.employee_manager')}} | |
| </h1> | |
| <ol class="breadcrumb"> | |
| <li><a href="{{ route('index') }}"><i class="fa fa-dashboard"></i> {{trans('messages.dashboard')}}</a></li> | |
| <li><a href="{{ route('notestatus') }}">{{trans('messages.employee')}}</a></li> | |
| <li class="active">{{trans('messages.note_status')}}</li> | |
| </ol> | |
| </section> | |
| <!-- Main content --> | |
| <section class="content"> | |
| <div class="row"> | |
| <div class="col-xs-12"> | |
| <div class="box box-primary"> | |
| <div class="box-header"> | |
| <h3 class="box-title">{{trans('messages.note_status')}}</h3> | |
| </div> | |
| <div class="savesuccess"> | |
| </div> | |
| <div class="row"> | |
| </div> | |
| <div class="box-body"> | |
| <table id="example1" class="table table-bordered table-hover"> | |
| <thead> | |
| <tr> | |
| <th style="width: 5%" class="text-center">#</th> | |
| <th class="text-center">Name</th> | |
| <th class="text-center">Status</th> | |
| <th class="text-center">Comment</th> | |
| <th style="width: 10%" class="text-center">{{trans('messages.actions')}}</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <?php | |
| $index = 1; | |
| foreach ($notestatus as $key => $value) : ?> | |
| <tr> | |
| <input type="hidden" name="id" value="{{ $value->id }}"/> | |
| <td><?php echo $index; $index++; ?></td> | |
| <td>{{ $value->candidate()->first()->last_name." ".$value->candidate()->first()->first_name }}</td> | |
| <td> | |
| {!! Form::select('statusrecord',$res_statusrecord,$value->status_record()->first()->id, ['class'=>'js-example-basic-multiple form-control']) !!} | |
| </td> | |
| <td><p style="display:none">{{ $value->comment }}</p><input value="{{ $value->comment }}" class="comment"/></td> | |
| <td> | |
| <div class="text-blue accept itemaction" title="Edit"> | |
| <i class="fa fa-fw fa-floppy-o"></i> | |
| </div> | |
| </td> | |
| </tr> | |
| <?php endforeach; ?> | |
| </tbody> | |
| </table> | |
| </div> | |
| <!-- /.box-body --> | |
| </div> | |
| <!-- /.box --> | |
| </div> | |
| <!-- /.col --> | |
| </div> | |
| <!-- /.row --> | |
| </section> | |
| <!-- /.content --> | |
| </div> | |
| <style type="text/css"> | |
| .itemaction{ | |
| display: block; | |
| float: left; | |
| margin-left: 10px; | |
| } | |
| </style> | |
| <script type="text/javascript"> | |
| $(document).ready(function(){ | |
| function lowcase(text) | |
| { | |
| if(text == "") return text; | |
| var res = text.toLowerCase(); | |
| return res; | |
| } | |
| $(".js-example-basic-multiple").select2({placeholder: "Please enter your group"}); | |
| $('.accept').click(function(){ | |
| var data = {}; | |
| data.id = $(this).parent().parent().find('input[name="id"]').val(); | |
| data.comment = $(this).parent().parent().find('.comment').val(); | |
| data.status_record_id = $(this).parent().parent().find('select[name="statusrecord"]').val(); | |
| console.log(data); | |
| $.ajax({ | |
| url : '{{ route("savenotestatus") }}', | |
| type : 'POST', | |
| data : {note : data , _token :"{{ csrf_token() }}" } | |
| }).done(function(res){ | |
| $div1=$('.error-message'); | |
| $div2=$('<div class="hidden alert alert-dismissible user-message text-center" style="margin-top: 30px" role="alert">'); | |
| $div2.append('<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>'); | |
| $div2.append("<span>Save Successfully</span>").addClass("alert-success").removeClass('hidden'); | |
| $div2.css("margin-bottom","0px"); | |
| console.log($div2); | |
| $div1.append($div2); | |
| $(".alert").delay(3000).hide(1000); | |
| setTimeout(function() { | |
| $('.alert').remove(); | |
| }, 5000); | |
| }); | |
| }); | |
| var dataobj = []; | |
| $('#example1 tbody tr').each(function(key,value){ | |
| var status = $(value).find('td:nth-child(4)').find(':selected').text(); | |
| var name = $(value).find('td:nth-child(3)').text(); | |
| var comment = $(value).find('td:nth-child(5) input').val(); | |
| dataobj.push({status : status,name : name ,comment : comment}); | |
| }); | |
| console.log(dataobj); | |
| $.fn.dataTable.ext.search.push( | |
| function( settings, data, dataIndex ) { | |
| var status = dataobj[dataIndex].status; | |
| var name = dataobj[dataIndex].name; | |
| var comment = dataobj[dataIndex].comment; | |
| var input_sm = $('.input-sm').val(); | |
| // console.log(text_date_receive); | |
| if(lowcase(status).indexOf(lowcase(input_sm)) > -1 || lowcase(name).indexOf(lowcase(input_sm)) > -1 || | |
| lowcase(comment).indexOf(lowcase(input_sm)) > -1) | |
| { | |
| return true; | |
| } | |
| return false; | |
| } | |
| ); | |
| }); | |
| </script> | |
| @stop | |
| @section ('body.js') | |
| <script src="{{asset('plugins/datatables/jquery.dataTables.min.js')}}" type="text/javascript"></script> | |
| <script src="{{asset('plugins/datatables/dataTables.bootstrap.min.js')}}" type="text/javascript"></script> | |
| <script type="text/javascript"> | |
| $(function () { | |
| function lowcase(text) | |
| { | |
| if(text == "") return text; | |
| var res = text.toLowerCase(); | |
| return res; | |
| } | |
| var oTable = $('#example1').dataTable({ | |
| "bPaginate": true, | |
| "bLengthChange": false, | |
| "bFilter": true, | |
| "bSort": true, | |
| "bInfo": false, | |
| "bAutoWidth": false | |
| }); | |
| var dataobj = []; | |
| $('#example1 tbody tr').each(function(key,value){ | |
| var text_status = $(value).find('td:nth-child(7)').find(':selected').text(); | |
| var text_employee = $(value).find('td:nth-child(8)').find(':selected').text(); | |
| var text_receive_date = $(value).find('td:nth-child(5) input').val(); | |
| var text_return_date = $(value).find('td:nth-child(6) input').val(); | |
| dataobj.push({text_status : text_status,text_employee : text_employee ,text_receive_date : text_receive_date,text_return_date : text_return_date}); | |
| }); | |
| $.fn.dataTable.ext.search.push( | |
| function( settings, data, dataIndex ) { | |
| //console.log(data); | |
| //var index = parseInt(data[0])-1; | |
| //var text_status = $('#example1 tbody tr').eq(dataIndex).find('td:nth-child(7)').find(':selected').text(); | |
| //var text_employee = $('#example1 tbody tr').eq(dataIndex).find('td:nth-child(8)').find(':selected').text(); | |
| // var text_date_receive = $('#example1 tbody tr').eq(dataIndex).find('td:nth-child(5) input').val(); | |
| // var text_date_return = $('#example1 tbody tr').eq(dataIndex).find('td:nth-child(6) input').val(); | |
| var text_status = dataobj[dataIndex].text_status; | |
| var text_employee = dataobj[dataIndex].text_employee; | |
| var text_receive_date = dataobj[dataIndex].text_receive_date; | |
| var text_return_date = dataobj[dataIndex].text_return_date; | |
| var input_sm = $('.input-sm').val(); | |
| console.log(input_sm); | |
| console.log(lowcase(text_receive_date)); | |
| console.log(lowcase(text_receive_date).indexOf(lowcase(input_sm))); | |
| // console.log(text_date_receive); | |
| if(lowcase(text_status).indexOf(lowcase(input_sm)) > -1 || lowcase(text_employee).indexOf(lowcase(input_sm)) > -1 || | |
| lowcase(data[1]).indexOf(lowcase(input_sm)) > -1 || lowcase(data[2]).indexOf(lowcase(input_sm)) > -1 | |
| || lowcase(text_receive_date).indexOf(lowcase(input_sm)) > -1 || lowcase(text_return_date).indexOf(lowcase(input_sm)) > -1 | |
| ) | |
| { | |
| return true; | |
| } | |
| return false; | |
| } | |
| ); | |
| }); | |
| </script> | |
| @stop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php namespace App; | |
| use Illuminate\Database\Eloquent\Model; | |
| class NoteStatus extends Model { | |
| protected $table = 'note_statuses'; | |
| protected $fillable = [ | |
| 'candidate_id', | |
| 'status_record_id', | |
| 'comment', | |
| 'created_at', | |
| 'updated_at', | |
| ]; | |
| public function candidate() { | |
| return $this->belongsTo('App\Candidate'); | |
| } | |
| public function status_record(){ | |
| return $this->belongsTo('App\StatusRecord'); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Http\Controllers; | |
| use App; | |
| use App\Employee; | |
| use Excel; | |
| use App\Device; | |
| use App\InformationDevice; | |
| use App\KindDevice; | |
| use App\ModelDevice; | |
| use App\OperatingSystem; | |
| use App\TypeDevice; | |
| use App\ReceiveDevice; | |
| use App\StatusDevice; | |
| use File; | |
| use Illuminate\Support\Facades\Redirect; | |
| use Input; | |
| use Request; | |
| use App\NoteStatus; | |
| use App\StatusRecord; | |
| class NoteStatusController extends AdminController { | |
| /** | |
| * Display a listing of the resource. | |
| * | |
| * @return Response | |
| */ | |
| public function index() | |
| { | |
| $notestatus = NoteStatus::all(); | |
| $statusrecord = StatusRecord::all(); | |
| $res_statusrecord = array(); | |
| foreach ($statusrecord as $key => $value) { | |
| $res_statusrecord += array($value->id => $value->name); | |
| } | |
| return view('employee.notestatus',compact('notestatus','res_statusrecord')); | |
| } | |
| public function save() | |
| { | |
| $data = Request::input('note'); | |
| NoteStatus::find($data['id'])->update($data); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment