diff --git a/app/Presenters/SupplierPresenter.php b/app/Presenters/SupplierPresenter.php new file mode 100644 index 0000000000..a56fd4b635 --- /dev/null +++ b/app/Presenters/SupplierPresenter.php @@ -0,0 +1,293 @@ + 'id', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.id'), + 'visible' => false, + ], + [ + 'field' => 'name', + 'searchable' => true, + 'sortable' => true, + 'switchable' => false, + 'title' => trans('general.name'), + 'visible' => true, + 'formatter' => 'suppliersLinkFormatter', + ], [ + 'field' => 'image', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.image'), + 'visible' => true, + 'formatter' => 'imageFormatter', + ], + [ + 'field' => 'assets_count', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.assets'), + 'titleTooltip' => trans('general.assets'), + 'visible' => true, + 'class' => 'css-barcode', + ], [ + 'field' => 'accessories_count', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.accessories'), + 'titleTooltip' => trans('general.accessories'), + 'visible' => true, + 'class' => 'css-accessory', + ], + [ + 'field' => 'licenses_count', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.licenses'), + 'titleTooltip' => trans('general.licenses'), + 'visible' => true, + 'class' => 'css-license', + ], [ + 'field' => 'components_count', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.components'), + 'titleTooltip' => trans('general.components'), + 'visible' => true, + 'class' => 'css-component', + ], [ + 'field' => 'consumables_count', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.consumables'), + 'titleTooltip' => trans('general.consumables'), + 'visible' => true, + 'class' => 'css-consumable', + ], [ + 'field' => 'url', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.url'), + 'visible' => true, + 'formatter' => 'externalLinkFormatter', + ], [ + 'field' => 'address', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('admin/locations/table.address'), + 'visible' => true, + ], [ + 'field' => 'address2', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('admin/locations/table.address2'), + 'visible' => false, + ], [ + 'field' => 'city', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('admin/locations/table.city'), + 'visible' => true, + ], [ + 'field' => 'state', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('admin/locations/table.state'), + 'visible' => true, + ], [ + 'field' => 'zip', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('admin/locations/table.zip'), + 'visible' => false, + ], [ + 'field' => 'country', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('admin/locations/table.country'), + 'visible' => false, + ], [ + 'field' => 'phone', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('admin/users/table.phone'), + 'visible' => false, + 'formatter' => 'phoneFormatter', + ], [ + 'field' => 'fax', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('admin/suppliers/table.fax'), + 'visible' => false, + 'formatter' => 'phoneFormatter', + ], [ + 'field' => 'notes', + 'searchable' => true, + 'sortable' => true, + 'visible' => false, + 'title' => trans('general.notes'), + ], [ + 'field' => 'created_at', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.created_at'), + 'visible' => false, + 'formatter' => 'dateDisplayFormatter', + ], [ + 'field' => 'created_by', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.created_by'), + 'visible' => false, + 'formatter' => 'usersLinkObjFormatter', + ], [ + 'field' => 'actions', + 'searchable' => false, + 'sortable' => false, + 'switchable' => false, + 'title' => trans('table.actions'), + 'visible' => true, + 'formatter' => 'suppliersActionsFormatter', + ], + ]; + + return json_encode($layout); + } + + public static function assignedAccessoriesDataTableLayout() + { + $layout = [ + [ + 'field' => 'id', + 'searchable' => false, + 'sortable' => false, + 'switchable' => true, + 'title' => trans('general.id'), + 'visible' => false, + ], + [ + 'field' => 'accessory', + 'searchable' => false, + 'sortable' => false, + 'switchable' => true, + 'title' => trans('general.accessory'), + 'visible' => true, + 'formatter' => 'accessoriesLinkObjFormatter', + ], + [ + 'field' => 'image', + 'searchable' => false, + 'sortable' => false, + 'switchable' => true, + 'title' => trans('general.image'), + 'visible' => true, + 'formatter' => 'imageFormatter', + ], + [ + 'field' => 'note', + 'searchable' => false, + 'sortable' => false, + 'switchable' => true, + 'title' => trans('general.notes'), + 'visible' => true, + ], + [ + 'field' => 'created_at', + 'searchable' => false, + 'sortable' => false, + 'switchable' => true, + 'title' => trans('admin/hardware/table.checkout_date'), + 'visible' => true, + 'formatter' => 'dateDisplayFormatter', + ], + [ + 'field' => 'created_by', + 'searchable' => false, + 'sortable' => false, + 'title' => trans('general.created_by'), + 'visible' => false, + 'formatter' => 'usersLinkObjFormatter', + ], + [ + 'field' => 'available_actions', + 'searchable' => false, + 'sortable' => false, + 'switchable' => false, + 'title' => trans('table.actions'), + 'formatter' => 'accessoriesInOutFormatter', + ], + ]; + + return json_encode($layout); + } + + /** + * Link to this locations name + * @return string + */ + public function nameUrl() + { + return (string) link_to_route('locations.show', $this->name, $this->id); + } + + /** + * Getter for Polymorphism. + * @return mixed + */ + public function name() + { + return $this->model->name; + } + + /** + * Url to view this item. + * @return string + */ + public function viewUrl() + { + return route('locations.show', $this->id); + } + + public function glyph() + { + return ''; + } + + public function fullName() + { + return $this->name; + } +} diff --git a/resources/views/suppliers/index.blade.php b/resources/views/suppliers/index.blade.php index f35ad983d8..918166ea6f 100755 --- a/resources/views/suppliers/index.blade.php +++ b/resources/views/suppliers/index.blade.php @@ -21,6 +21,7 @@
- - - - - - - - - - - - - - - - - - - - - -
{{ trans('admin/suppliers/table.id') }}{{ trans('general.image') }}{{ trans('admin/suppliers/table.name') }}{{ trans('admin/suppliers/table.address') }}{{ trans('admin/suppliers/table.contact') }}{{ trans('admin/suppliers/table.email') }}{{ trans('admin/suppliers/table.phone') }}{{ trans('admin/suppliers/table.fax') }}{{ trans('general.url') }}{{ trans('admin/suppliers/table.assets') }}{{ trans('general.accessories') }}{{ trans('admin/suppliers/table.licenses') }}{{ trans('general.components') }}{{ trans('general.consumables') }}{{ trans('general.notes') }}{{ trans('general.created_at') }}{{ trans('general.created_by') }}{{ trans('table.actions') }}