芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/qrafiqxcreativeagency.com/accounts/office/app/DataTables/LeadFollowupDataTable.php
eloquent($query) ->addColumn('action', function ($row) { $action = '
'; $action .= '
' . trans('app.edit') . '
'; $action .= '
' . trans('app.delete') . '
'; $action .= '
'; return $action; }) ->addColumn('status', function($row) { $status = ''; $status .= '
'; $status .= '
status == 'incomplete') { $status .= 'selected'; } $status .= ' data-content="
' . trans('app.incomplete') .' " > ' . trans('app.incomplete') . '
'; $status .= '
status == 'canceled') { $status .= 'selected'; } $status .= ' data-content="
' . trans('app.canceled') .' " > ' . trans('app.canceled') . '
'; $status .= '
status == 'completed') { $status .= 'selected'; } $status .= ' data-content="
'. trans('app.completed') . '" > '. trans('app.completed'). '
'; $status .= '
'; return $status; }) ->addColumn('statusChange', function ($row) { return $row->status; }) ->addColumn('created_at', function ($row) { return $row->created_at->timezone(company()->timezone)->format(company()->date_format. ' '.company()->time_format); }) ->addColumn('next_follow_up', function ($row) { return $row->next_follow_up_date->format(company()->date_format. ' '.company()->time_format); }) ->smart(false) ->setRowId(function ($row) { return 'row-' . $row->id; }) ->rawColumns(['action', 'status']); } /** * Get query source of dataTable. * * @param LeadFollowup $model * @return \Illuminate\Database\Eloquent\Builder */ public function query(LeadFollowup $model) { $lead = $model->newQuery(); if (request()->has('leadId') && request()->leadId != '') { $lead = $lead->where('lead_id', request()->leadId); } return $lead; } /** * Optional method if you want to use html builder. * * @return \Yajra\DataTables\Html\Builder */ public function html() { $dataTable = $this->setBuilder('leadfollowup-table') ->parameters([ 'initComplete' => 'function () { window.LaravelDataTables["leadfollowup-table"].buttons().container() .appendTo("#table-actions") }', 'fnDrawCallback' => 'function( oSettings ) { $("body").tooltip({ selector: \'[data-toggle="tooltip"]\' }); $(".statusChange").selectpicker(); }', ]); if (canDataTableExport()) { $dataTable->buttons(Button::make(['extend' => 'excel', 'text' => '
' . trans('app.exportExcel')])); } return $dataTable; } /** * Get columns. * * @return array */ protected function getColumns() { return [ __('app.createdOn') => ['data' => 'created_at', 'name' => 'created_at', 'title' => __('app.createdOn')], __('modules.lead.nextFollowUp') => ['data' => 'next_follow_up', 'name' => 'next_follow_up', 'title' => __('modules.lead.nextFollowUp')], __('app.remark') => ['data' => 'remark', 'name' => 'remark', 'title' => __('app.remark')], __('app.status') => ['data' => 'status', 'name' => 'status', 'exportable' => false, 'title' => __('app.status')], __('app.Changestatus') => ['data' => 'statusChange', 'name' => 'statusChange', 'visible' => false, 'title' => __('app.Changestatus')], Column::computed('action', __('app.action')) ->exportable(false) ->printable(false) ->orderable(false) ->searchable(false) ->addClass('text-right pr-20') ]; } }