Merge pull request #936 from vsposato/feature/857_AssetRepairUpgradeTrackingFrom2.0

Feature/857 asset repair upgrade tracking from2.0
This commit is contained in:
snipe
2015-07-20 22:45:59 -07:00
22 changed files with 1873 additions and 476 deletions

View File

@@ -0,0 +1,464 @@
<?php
namespace Controllers\Admin;
use AdminController;
use AssetMaintenance;
use Carbon\Carbon;
use Datatable;
use DB;
use Input;
use Lang;
use Log;
use Mail;
use Redirect;
use Response;
use Sentry;
use Slack;
use Str;
use Supplier;
use TCPDF;
use Validator;
use View;
class AssetMaintenancesController extends AdminController
{
/**
* getIndex
*
* @return mixed
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0
*/
public function getIndex()
{
return View::make( 'backend/asset_maintenances/index' );
}
/**
* getDatatable
* Gets the datatable for the index page
*
* @return mixed
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0
*/
public function getDatatable()
{
$assetMaintenances = AssetMaintenance::orderBy( 'created_at', 'DESC' )
->get();
$actions = new \Chumper\Datatable\Columns\FunctionColumn( 'actions', function ( $assetMaintenances ) {
return '<a href="' . route( 'update/asset_maintenance', $assetMaintenances->id )
. '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'
. route( 'delete/asset_maintenance', $assetMaintenances->id ) . '" data-content="'
. Lang::get( 'admin/asset_maintenances/message.delete.confirm' ) . '" data-title="'
. Lang::get( 'general.delete' ) . ' ' . htmlspecialchars( $assetMaintenances->title )
. '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
} );
return Datatable::collection( $assetMaintenances )
->addColumn( 'asset', function ( $assetMaintenances ) {
return link_to( '/hardware/' . $assetMaintenances->asset_id . '/view',
mb_strimwidth( $assetMaintenances->asset->name, 0, 50, "..." ) );
} )
->addColumn( 'supplier', function ( $assetMaintenances ) {
return link_to( '/admin/settings/suppliers/' . $assetMaintenances->supplier_id
. '/view',
mb_strimwidth( $assetMaintenances->supplier->name, 0, 50, "..." ) );
} )
->addColumn( 'asset_maintenance_type', function ( $assetMaintenances ) {
return $assetMaintenances->asset_maintenance_type;
} )
->addColumn( 'title', function ( $assetMaintenances ) {
return link_to( '/admin/asset_maintenances/' . $assetMaintenances->id . '/view',
mb_strimwidth( $assetMaintenances->title, 0, 50, "..." ) );
} )
->addColumn( 'start_date', function ( $assetMaintenances ) {
return $assetMaintenances->start_date;
} )
->addColumn( 'completion_date', function ( $assetMaintenances ) {
return $assetMaintenances->completion_date;
} )
->addColumn( 'asset_maintenance_time', function ( $assetMaintenances ) {
if (is_null( $assetMaintenances->asset_maintenance_time )) {
$assetMaintenances->asset_maintenance_time = Carbon::now()
->diffInDays( Carbon::parse( $assetMaintenances->start_date ) );
}
return intval( $assetMaintenances->asset_maintenance_time );
} )
->addColumn( 'cost', function ( $assetMaintenances ) {
return sprintf( Lang::get( 'general.currency' ) . '%01.2f', $assetMaintenances->cost );
} )
->addColumn( $actions )
->searchColumns( 'asset', 'supplier', 'asset_maintenance_type', 'title', 'start_date',
'completion_date', 'asset_maintenance_time', 'cost', 'actions' )
->orderColumns( 'asset', 'supplier', 'asset_maintenance_type', 'title', 'start_date',
'completion_date', 'asset_maintenance_time', 'cost', 'actions' )
->make();
}
/**
* getCreate
*
* @param null $assetId
*
* @return mixed
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0
*/
public function getCreate( $assetId = null )
{
// Prepare Asset Maintenance Type List
$assetMaintenanceType = [
'' => 'Select an asset maintenance type',
] + AssetMaintenance::getImprovementOptions();
// Mark the selected asset, if it came in
$selectedAsset = $assetId;
// Get the possible assets using a left join to get a list of assets and some other helpful info
$asset = DB::table( 'assets' )
->leftJoin( 'users', 'users.id', '=', 'assets.assigned_to' )
->leftJoin( 'models', 'assets.model_id', '=', 'models.id' )
->select( 'assets.id', 'assets.name', 'first_name', 'last_name', 'asset_tag',
DB::raw( 'concat(first_name," ",last_name) as full_name, assets.id as id, models.name as modelname' ) )
->whereNull( 'assets.deleted_at' )
->get();
$asset_array = json_decode( json_encode( $asset ), true );
$asset_element[ '' ] = 'Please select an asset';
// Build a list out of the data results
for ($x = 0; $x < count( $asset_array ); $x++) {
if ($asset_array[ $x ][ 'full_name' ] != '') {
$full_name = ' (' . $asset_array[ $x ][ 'full_name' ] . ') ' . $asset_array[ $x ][ 'modelname' ];
} else {
$full_name = ' (Unassigned) ' . $asset_array[ $x ][ 'modelname' ];
}
$asset_element[ $asset_array[ $x ][ 'id' ] ] =
$asset_array[ $x ][ 'asset_tag' ] . ' - ' . $asset_array[ $x ][ 'name' ] . $full_name;
}
// Get Supplier List
$supplier_list = [ '' => 'Select Supplier' ] + Supplier::orderBy( 'name', 'asc' )
->lists( 'name', 'id' );
// Render the view
return View::make( 'backend/asset_maintenances/edit' )
->with( 'asset_list', $asset_element )
->with( 'selectedAsset', $selectedAsset )
->with( 'supplier_list', $supplier_list )
->with( 'assetMaintenanceType', $assetMaintenanceType )
->with( 'assetMaintenance', new AssetMaintenance );
}
/**
* postCreate
*
* @return mixed
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0
*/
public function postCreate()
{
// get the POST data
$new = Input::all();
// create a new model instance
$assetMaintenance = new AssetMaintenance();
// attempt validation
if ($assetMaintenance->validate( $new )) {
if (e( Input::get( 'supplier_id' ) ) == '') {
$assetMaintenance->supplier_id = null;
} else {
$assetMaintenance->supplier_id = e( Input::get( 'supplier_id' ) );
}
if (e( Input::get( 'is_warranty' ) ) == '') {
$assetMaintenance->is_warranty = 0;
} else {
$assetMaintenance->is_warranty = e( Input::get( 'is_warranty' ) );
}
if (e( Input::get( 'cost' ) ) == '') {
$assetMaintenance->cost = '';
} else {
$assetMaintenance->cost = ParseFloat( e( Input::get( 'cost' ) ) );
}
if (e( Input::get( 'notes' ) ) == '') {
$assetMaintenance->notes = null;
} else {
$assetMaintenance->notes = e( Input::get( 'notes' ) );
}
// Save the asset maintenance data
$assetMaintenance->asset_id = e( Input::get( 'asset_id' ) );
$assetMaintenance->asset_maintenance_type = e( Input::get( 'asset_maintenance_type' ) );
$assetMaintenance->title = e( Input::get( 'title' ) );
$assetMaintenance->start_date = e( Input::get( 'start_date' ) );
$assetMaintenance->completion_date = e( Input::get( 'completion_date' ) );
if (( $assetMaintenance->completion_date == "" )
|| ( $assetMaintenance->completion_date == "0000-00-00" )
) {
$assetMaintenance->completion_date = null;
}
// Was the asset maintenance created?
if ($assetMaintenance->save()) {
// Redirect to the new asset maintenance page
return Redirect::to( "admin/asset_maintenances" )
->with( 'success', Lang::get( 'admin/asset_maintenances/message.create.success' ) );
}
} else {
// failure
$errors = $assetMaintenance->errors();
return Redirect::back()
->withInput()
->withErrors( $errors );
}
// Redirect to the asset maintenance create page
return Redirect::to( 'admin/asset_maintenances/edit' )
->with( 'error', Lang::get( 'admin/asset_maintenances/message.create.error' ) )
->with( 'assetMaintenance', new AssetMaintenance );
}
/**
* getEdit
*
* @param null $assetMaintenanceId
*
* @return mixed
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0
*/
public function getEdit( $assetMaintenanceId = null )
{
// Check if the asset maintenance exists
if (is_null( $assetMaintenance = AssetMaintenance::find( $assetMaintenanceId ) )) {
// Redirect to the improvement management page
return Redirect::to( 'admin/asset_maintenances' )
->with( 'error', Lang::get( 'admin/asset_maintenances/message.not_found' ) );
}
if ($assetMaintenance->completion_date == '0000-00-00') {
$assetMaintenance->completion_date = null;
}
if ($assetMaintenance->start_date == '0000-00-00') {
$assetMaintenance->start_date = null;
}
if ($assetMaintenance->cost == '0.00') {
$assetMaintenance->cost = null;
}
// Prepare Improvement Type List
$assetMaintenanceType = [
'' => 'Select an improvement type',
] + AssetMaintenance::getImprovementOptions();
// Get the possible assets using a left join to get a list of assets and some other helpful info
$asset = DB::table( 'assets' )
->leftJoin( 'users', 'users.id', '=', 'assets.assigned_to' )
->leftJoin( 'models', 'assets.model_id', '=', 'models.id' )
->select( 'assets.id', 'assets.name', 'first_name', 'last_name', 'asset_tag',
DB::raw( 'concat(first_name," ",last_name) as full_name, assets.id as id, models.name as modelname' ) )
->whereNull( 'assets.deleted_at' )
->get();
$asset_array = json_decode( json_encode( $asset ), true );
$asset_element[ '' ] = 'Please select an asset';
// Build a list out of the data results
for ($x = 0; $x < count( $asset_array ); $x++) {
if ($asset_array[ $x ][ 'full_name' ] != '') {
$full_name = ' (' . $asset_array[ $x ][ 'full_name' ] . ') ' . $asset_array[ $x ][ 'modelname' ];
} else {
$full_name = ' (Unassigned) ' . $asset_array[ $x ][ 'modelname' ];
}
$asset_element[ $asset_array[ $x ][ 'id' ] ] =
$asset_array[ $x ][ 'asset_tag' ] . ' - ' . $asset_array[ $x ][ 'name' ] . $full_name;
}
// Get Supplier List
$supplier_list = [ '' => 'Select Supplier' ] + Supplier::orderBy( 'name', 'asc' )
->lists( 'name', 'id' );
// Render the view
return View::make( 'backend/asset_maintenances/edit' )
->with( 'asset_list', $asset_element )
->with( 'selectedAsset', null )
->with( 'supplier_list', $supplier_list )
->with( 'assetMaintenanceType', $assetMaintenanceType )
->with( 'assetMaintenance', $assetMaintenance );
}
/**
* postEdit
*
* @param null $assetMaintenanceId
*
* @return mixed
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0
*/
public function postEdit( $assetMaintenanceId = null )
{
// get the POST data
$new = Input::all();
// Check if the asset maintenance exists
if (is_null( $assetMaintenance = AssetMaintenance::find( $assetMaintenanceId ) )) {
// Redirect to the asset maintenance management page
return Redirect::to( 'admin/asset_maintenances' )
->with( 'error', Lang::get( 'admin/asset_maintenances/message.not_found' ) );
}
// attempt validation
if ($assetMaintenance->validate( $new )) {
if (e( Input::get( 'supplier_id' ) ) == '') {
$assetMaintenance->supplier_id = null;
} else {
$assetMaintenance->supplier_id = e( Input::get( 'supplier_id' ) );
}
if (e( Input::get( 'is_warranty' ) ) == '') {
$assetMaintenance->is_warranty = 0;
} else {
$assetMaintenance->is_warranty = e( Input::get( 'is_warranty' ) );
}
if (e( Input::get( 'cost' ) ) == '') {
$assetMaintenance->cost = '';
} else {
$assetMaintenance->cost = ParseFloat( e( Input::get( 'cost' ) ) );
}
if (e( Input::get( 'notes' ) ) == '') {
$assetMaintenance->notes = null;
} else {
$assetMaintenance->notes = e( Input::get( 'notes' ) );
}
// Save the asset maintenance data
$assetMaintenance->asset_id = e( Input::get( 'asset_id' ) );
$assetMaintenance->asset_maintenance_type = e( Input::get( 'asset_maintenance_type' ) );
$assetMaintenance->title = e( Input::get( 'title' ) );
$assetMaintenance->start_date = e( Input::get( 'start_date' ) );
$assetMaintenance->completion_date = e( Input::get( 'completion_date' ) );
if (( $assetMaintenance->completion_date == "" )
|| ( $assetMaintenance->completion_date == "0000-00-00" )
) {
$assetMaintenance->completion_date = null;
if (( $assetMaintenance->asset_maintenance_time !== 0 )
|| ( !is_null( $assetMaintenance->asset_maintenance_time ) )
) {
$assetMaintenance->asset_maintenance_time = null;
}
}
if (( $assetMaintenance->completion_date !== "" )
&& ( $assetMaintenance->completion_date !== "0000-00-00" )
&& ( $assetMaintenance->start_date !== "" )
&& ( $assetMaintenance->start_date !== "0000-00-00" )
) {
$startDate = Carbon::parse( $assetMaintenance->start_date );
$completionDate = Carbon::parse( $assetMaintenance->completion_date );
$assetMaintenance->asset_maintenance_time = $completionDate->diffInDays( $startDate );
}
// Was the asset maintenance created?
if ($assetMaintenance->save()) {
// Redirect to the new asset maintenance page
return Redirect::to( "admin/asset_maintenances" )
->with( 'success', Lang::get( 'admin/asset_maintenances/message.create.success' ) );
}
} else {
// failure
$errors = $assetMaintenance->errors();
return Redirect::back()
->withInput()
->withErrors( $errors );
}
// Redirect to the improvement create page
return Redirect::to( 'admin/asset_maintenances/edit' )
->with( 'error', Lang::get( 'admin/asset_maintenances/message.create.error' ) )
->with( 'assetMaintenance', $assetMaintenance );
}
/**
* getDelete
*
* @param $assetMaintenanceId
*
* @return mixed
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0
*/
public function getDelete( $assetMaintenanceId )
{
// Check if the asset maintenance exists
if (is_null( $assetMaintenance = AssetMaintenance::find( $assetMaintenanceId ) )) {
// Redirect to the asset maintenance management page
return Redirect::to( 'admin/asset_maintenances' )
->with( 'error', Lang::get( 'admin/asset_maintenances/message.not_found' ) );
}
// Delete the asset maintenance
$assetMaintenance->delete();
// Redirect to the asset_maintenance management page
return Redirect::to( 'admin/asset_maintenances' )
->with( 'success', Lang::get( 'admin/asset_maintenances/message.delete.success' ) );
}
/**
* getView
*
* @param $assetMaintenanceId
*
* @return mixed
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0
*/
public function getView( $assetMaintenanceId )
{
// Check if the asset maintenance exists
if (is_null( $assetMaintenance = AssetMaintenance::find( $assetMaintenanceId ) )) {
// Redirect to the asset maintenance management page
return Redirect::to( 'admin/asset_maintenances' )
->with( 'error', Lang::get( 'admin/asset_maintenances/message.not_found' ) );
}
return View::make( 'backend/asset_maintenances/view')->with('assetMaintenance', $assetMaintenance);
}
}

View File

@@ -5,6 +5,7 @@ use Input;
use Lang;
use Asset;
use Supplier;
use AssetMaintenance;
use Statuslabel;
use User;
use Setting;

View File

@@ -1,22 +1,24 @@
<?php namespace Controllers\Admin;
use Actionlog;
use AdminController;
use Input;
use Lang;
use License;
use Asset;
use User;
use View;
use Carbon\Carbon;
use Illuminate\Support\Facades\Lang;
use Illuminate\Support\Facades\Response;
use AssetMaintenance;
use Illuminate\Support\Facades\View;
use Input;
use License;
use Location;
use Redirect;
use Response;
use Actionlog;
use Setting;
use League\Csv\Writer;
use League\Csv\Reader;
class ReportsController extends AdminController
{
/**
* Show Asset Report
*
@@ -24,9 +26,14 @@ class ReportsController extends AdminController
*/
public function getAssetsReport()
{
// Grab all the assets
$assets = Asset::with('model','assigneduser.userLoc','assetstatus','defaultLoc','assetlog','supplier','model.manufacturer')->orderBy('created_at', 'DESC')->get();
return View::make('backend/reports/asset', compact('assets'));
$assets = Asset::with( 'model', 'assigneduser.userLoc', 'assetstatus', 'defaultLoc', 'assetlog', 'supplier',
'model.manufacturer' )
->orderBy( 'created_at', 'DESC' )
->get();
return View::make( 'backend/reports/asset', compact( 'assets' ) );
}
/**
@@ -36,10 +43,12 @@ class ReportsController extends AdminController
*/
public function exportAssetReport()
{
// Grab all the assets
$assets = Asset::orderBy('created_at', 'DESC')->get();
$rows = array();
// Grab all the assets
$assets = Asset::orderBy( 'created_at', 'DESC' )
->get();
$rows = [ ];
// Create the header row
$header = array(
@@ -63,58 +72,58 @@ class ReportsController extends AdminController
// Create a row per asset
foreach ($assets as $asset) {
$row = array();
$row[] = $asset->asset_tag;
$row = [ ];
$row[ ] = $asset->asset_tag;
if ($asset->model->manufacturer) {
$row[] = $asset->model->manufacturer->name;
$row[ ] = $asset->model->manufacturer->name;
} else {
$row[] = '';
$row[ ] = '';
}
$row[] = '"'.$asset->model->name.'"';
$row[] = '"'.$asset->model->modelno.'"';
$row[] = $asset->name;
$row[] = $asset->serial;
$row[ ] = '"' . $asset->model->name . '"';
$row[ ] = '"' . $asset->model->modelno . '"';
$row[ ] = $asset->name;
$row[ ] = $asset->serial;
if ($asset->assetstatus) {
$row[] = $asset->assetstatus->name;
$row[ ] = $asset->assetstatus->name;
} else {
$row[] = '';
$row[ ] = '';
}
$row[] = $asset->purchase_date;
$row[] = '"'.number_format($asset->purchase_cost).'"';
$row[ ] = $asset->purchase_date;
$row[ ] = '"' . number_format( $asset->purchase_cost ) . '"';
if ($asset->order_number) {
$row[] = $asset->order_number;
$row[ ] = $asset->order_number;
} else {
$row[] = '';
$row[ ] = '';
}
if ($asset->supplier_id) {
$row[] = $asset->supplier->name;
$row[ ] = $asset->supplier->name;
} else {
$row[] = '';
$row[ ] = '';
}
if ($asset->assigned_to > 0) {
$user = User::find($asset->assigned_to);
$row[] = $user->fullName();
$user = User::find( $asset->assigned_to );
$row[ ] = $user->fullName();
} else {
$row[] = ''; // Empty string if unassigned
$row[ ] = ''; // Empty string if unassigned
}
if (($asset->assigned_to > 0) && ($asset->assigneduser->location_id > 0)) {
$location = Location::find($asset->assigneduser->location_id);
if (( $asset->assigned_to > 0 ) && ( $asset->assigneduser->location_id > 0 )) {
$location = Location::find( $asset->assigneduser->location_id );
if ($location->name) {
$row[] = $location->name;
$row[ ] = $location->name;
} else {
$row[] = '';
$row[ ] = '';
}
} elseif ($asset->rtd_location_id) {
$location = Location::find($asset->rtd_location_id);
$location = Location::find( $asset->rtd_location_id );
if ($location->name) {
$row[] = $location->name;
$row[ ] = $location->name;
} else {
$row[] = '';
$row[ ] = '';
}
} else {
$row[] = ''; // Empty string if location is not set
$row[ ] = ''; // Empty string if location is not set
}
if ($asset->notes) {
@@ -127,10 +136,10 @@ class ReportsController extends AdminController
}
// spit out a csv
$csv = implode($rows, "\n");
$response = Response::make($csv, 200);
$response->header('Content-Type', 'text/csv');
$response->header('Content-disposition', 'attachment;filename=report.csv');
$csv = implode( $rows, "\n" );
$response = Response::make( $csv, 200 );
$response->header( 'Content-Type', 'text/csv' );
$response->header( 'Content-disposition', 'attachment;filename=report.csv' );
return $response;
}
@@ -142,9 +151,13 @@ class ReportsController extends AdminController
*/
public function getDeprecationReport()
{
// Grab all the assets
$assets = Asset::with('model','assigneduser','assetstatus','defaultLoc','assetlog')->orderBy('created_at', 'DESC')->get();
return View::make('backend/reports/depreciation', compact('assets'));
$assets = Asset::with( 'model', 'assigneduser', 'assetstatus', 'defaultLoc', 'assetlog' )
->orderBy( 'created_at', 'DESC' )
->get();
return View::make( 'backend/reports/depreciation', compact( 'assets' ) );
}
/**
@@ -154,8 +167,11 @@ class ReportsController extends AdminController
*/
public function exportDeprecationReport()
{
// Grab all the assets
$assets = Asset::with('model','assigneduser','assetstatus','defaultLoc','assetlog')->orderBy('created_at', 'DESC')->get();
$assets = Asset::with( 'model', 'assigneduser', 'assetstatus', 'defaultLoc', 'assetlog' )
->orderBy( 'created_at', 'DESC' )
->get();
$csv = \League\Csv\Writer::createFromFileObject(new \SplTempFileObject());
$csv->setOutputBOM(Reader::BOM_UTF16_BE);
@@ -180,30 +196,29 @@ class ReportsController extends AdminController
// Create a row per asset
foreach ($assets as $asset) {
$row = array();
$row[] = $asset->asset_tag;
$row[] = $asset->name;
$row[] = $asset->serial;
$row = [ ];
$row[ ] = $asset->asset_tag;
$row[ ] = $asset->name;
$row[ ] = $asset->serial;
if ($asset->assigned_to > 0) {
$user = User::find($asset->assigned_to);
$row[] = $user->fullName();
} else {
$row[] = ''; // Empty string if unassigned
$user = User::find( $asset->assigned_to );
$row[ ] = $user->fullName();
} else {
$row[ ] = ''; // Empty string if unassigned
}
if (($asset->assigned_to > 0) && ($asset->assigneduser->location_id > 0)) {
$location = Location::find($asset->assigneduser->location_id);
if (( $asset->assigned_to > 0 ) && ( $asset->assigneduser->location_id > 0 )) {
$location = Location::find( $asset->assigneduser->location_id );
if ($location->city) {
$row[] = $location->city . ', ' . $location->state;
} elseif ($location->name) {
$row[] = $location->name;
$row[ ] = $location->name;
} else {
$row[] = '';
$row[ ] = '';
}
} else {
$row[] = ''; // Empty string if location is not set
$row[ ] = ''; // Empty string if location is not set
}
@@ -226,23 +241,25 @@ class ReportsController extends AdminController
}
/**
/**
* Show Report for Activity
*
* @return View
*/
public function getActivityReport()
public function getActivityReport()
{
$log_actions = Actionlog::orderBy('created_at', 'DESC')
->with('adminlog')
->with('accessorylog')
->with('assetlog')
->with('licenselog')
->with('userlog')
->orderBy('created_at','DESC')
->get();
return View::make('backend/reports/activity', compact('log_actions'));
$log_actions = Actionlog::orderBy( 'created_at', 'DESC' )
->with( 'adminlog' )
->with( 'accessorylog' )
->with( 'assetlog' )
->with( 'licenselog' )
->with( 'userlog' )
->orderBy( 'created_at', 'DESC' )
->get();
return View::make( 'backend/reports/activity', compact( 'log_actions' ) );
}
@@ -253,8 +270,11 @@ class ReportsController extends AdminController
*/
public function getLicenseReport()
{
$licenses = License::orderBy('created_at', 'DESC')->get();
return View::make('backend/reports/licenses', compact('licenses'));
$licenses = License::orderBy( 'created_at', 'DESC' )
->get();
return View::make( 'backend/reports/licenses', compact( 'licenses' ) );
}
/**
@@ -264,225 +284,296 @@ class ReportsController extends AdminController
*/
public function exportLicenseReport()
{
$licenses = License::orderBy('created_at', 'DESC')->get();
$rows = array();
$header = array(
Lang::get('admin/licenses/table.title'),
Lang::get('admin/licenses/table.serial'),
Lang::get('admin/licenses/form.seats'),
Lang::get('admin/licenses/form.remaining_seats'),
Lang::get('admin/licenses/form.expiration'),
Lang::get('admin/licenses/form.date'),
Lang::get('admin/licenses/form.cost')
);
$header = array_map('trim', $header);
$rows[] = implode($header, ', ');
$licenses = License::orderBy( 'created_at', 'DESC' )
->get();
$rows = [ ];
$header = [
Lang::get( 'admin/licenses/table.title' ),
Lang::get( 'admin/licenses/table.serial' ),
Lang::get( 'admin/licenses/form.seats' ),
Lang::get( 'admin/licenses/form.remaining_seats' ),
Lang::get( 'admin/licenses/form.expiration' ),
Lang::get( 'admin/licenses/form.date' ),
Lang::get( 'admin/licenses/form.cost' )
];
$header = array_map( 'trim', $header );
$rows[ ] = implode( $header, ', ' );
// Row per license
foreach ($licenses as $license) {
$row = array();
$row[] = $license->name;
$row[] = $license->serial;
$row[] = $license->seats;
$row[] = $license->remaincount();
$row[] = $license->expiration_date;
$row[] = $license->purchase_date;
$row[] = '"'.number_format($license->purchase_cost).'"';
$row = [ ];
$row[ ] = $license->name;
$row[ ] = $license->serial;
$row[ ] = $license->seats;
$row[ ] = $license->remaincount();
$row[ ] = $license->expiration_date;
$row[ ] = $license->purchase_date;
$row[ ] = '"' . number_format( $license->purchase_cost ) . '"';
$rows[] = implode($row, ',');
$rows[ ] = implode( $row, ',' );
}
$csv = implode($rows, "\n");
$response = Response::make($csv, 200);
$response->header('Content-Type', 'text/csv');
$response->header('Content-disposition', 'attachment;filename=report.csv');
$csv = implode( $rows, "\n" );
$response = Response::make( $csv, 200 );
$response->header( 'Content-Type', 'text/csv' );
$response->header( 'Content-disposition', 'attachment;filename=report.csv' );
return $response;
}
public function getCustomReport()
{
return View::make('backend/reports/custom');
return View::make( 'backend/reports/custom' );
}
public function postCustom()
{
$assets = Asset::orderBy('created_at', 'DESC')->get();
$rows = array();
$header = array();
if (e(Input::get('asset_name')) == '1')
{
$header[] = 'Asset Name';
$assets = Asset::orderBy( 'created_at', 'DESC' )
->get();
$rows = [ ];
$header = [ ];
if (e( Input::get( 'asset_name' ) ) == '1') {
$header[ ] = 'Asset Name';
}
if (e(Input::get('asset_tag')) == '1')
{
$header[] = 'Asset Tag';
if (e( Input::get( 'asset_tag' ) ) == '1') {
$header[ ] = 'Asset Tag';
}
if (e(Input::get('manufacturer')) == '1')
{
$header[] = 'Manufacturer';
if (e( Input::get( 'manufacturer' ) ) == '1') {
$header[ ] = 'Manufacturer';
}
if (e(Input::get('model')) == '1')
{
$header[] = 'Model';
$header[] = 'Model Number';
if (e( Input::get( 'model' ) ) == '1') {
$header[ ] = 'Model';
$header[ ] = 'Model Number';
}
if (e(Input::get('serial')) == '1')
{
$header[] = 'Serial';
if (e( Input::get( 'serial' ) ) == '1') {
$header[ ] = 'Serial';
}
if (e(Input::get('purchase_date')) == '1')
{
$header[] = 'Purchase Date';
if (e( Input::get( 'purchase_date' ) ) == '1') {
$header[ ] = 'Purchase Date';
}
if ((e(Input::get('purchase_cost')) == '1') && (e(Input::get('depreciation')) == '0'))
{
$header[] = 'Purchase Cost';
if (( e( Input::get( 'purchase_cost' ) ) == '1' ) && ( e( Input::get( 'depreciation' ) ) == '0' )) {
$header[ ] = 'Purchase Cost';
}
if (e(Input::get('order')) == '1')
{
$header[] = 'Order Number';
if (e( Input::get( 'order' ) ) == '1') {
$header[ ] = 'Order Number';
}
if (e(Input::get('supplier')) == '1')
{
$header[] = 'Supplier';
if (e( Input::get( 'supplier' ) ) == '1') {
$header[ ] = 'Supplier';
}
if (e(Input::get('location')) == '1')
{
$header[] = 'Location';
if (e( Input::get( 'location' ) ) == '1') {
$header[ ] = 'Location';
}
if (e(Input::get('assigned_to')) == '1')
{
$header[] = 'Assigned To';
if (e( Input::get( 'assigned_to' ) ) == '1') {
$header[ ] = 'Assigned To';
}
if (e(Input::get('status')) == '1')
{
$header[] = 'Status';
if (e( Input::get( 'status' ) ) == '1') {
$header[ ] = 'Status';
}
if (e(Input::get('warranty')) == '1')
{
$header[] = 'Warranty';
$header[] = 'Warranty Expires';
if (e( Input::get( 'warranty' ) ) == '1') {
$header[ ] = 'Warranty';
$header[ ] = 'Warranty Expires';
}
if (e(Input::get('depreciation')) == '1')
{
$header[] = 'Purchase Cost';
$header[] = 'Value';
$header[] = 'Diff';
if (e( Input::get( 'depreciation' ) ) == '1') {
$header[ ] = 'Purchase Cost';
$header[ ] = 'Value';
$header[ ] = 'Diff';
}
$header = array_map('trim', $header);
$rows[] = implode($header, ',');
$header = array_map( 'trim', $header );
$rows[ ] = implode( $header, ',' );
foreach($assets as $asset) {
$row = array();
if (e(Input::get('asset_name')) == '1') {
$row[] = $asset->name;
foreach ($assets as $asset) {
$row = [ ];
if (e( Input::get( 'asset_name' ) ) == '1') {
$row[ ] = $asset->name;
}
if (e(Input::get('asset_tag')) == '1') {
$row[] = $asset->asset_tag;
if (e( Input::get( 'asset_tag' ) ) == '1') {
$row[ ] = $asset->asset_tag;
}
if (e(Input::get('manufacturer')) == '1') {
if (e( Input::get( 'manufacturer' ) ) == '1') {
if ($asset->model->manufacturer) {
$row[] = $asset->model->manufacturer->name;
$row[ ] = $asset->model->manufacturer->name;
} else {
$row[] = '';
$row[ ] = '';
}
}
if (e(Input::get('model')) == '1') {
$row[] = '"'.$asset->model->name.'"';
$row[] = '"'.$asset->model->modelno.'"';
if (e( Input::get( 'model' ) ) == '1') {
$row[ ] = '"' . $asset->model->name . '"';
$row[ ] = '"' . $asset->model->modelno . '"';
}
if (e(Input::get('serial')) == '1') {
$row[] = $asset->serial;
if (e( Input::get( 'serial' ) ) == '1') {
$row[ ] = $asset->serial;
}
if (e(Input::get('purchase_date')) == '1') {
$row[] = $asset->purchase_date;
if (e( Input::get( 'purchase_date' ) ) == '1') {
$row[ ] = $asset->purchase_date;
}
if (e(Input::get('purchase_cost')) == '1') {
$row[] = '"'.number_format($asset->purchase_cost).'"';
if (e( Input::get( 'purchase_cost' ) ) == '1') {
$row[ ] = '"' . number_format( $asset->purchase_cost ) . '"';
}
if (e(Input::get('order')) == '1') {
if (e( Input::get( 'order' ) ) == '1') {
if ($asset->order_number) {
$row[] = $asset->order_number;
$row[ ] = $asset->order_number;
} else {
$row[] = '';
$row[ ] = '';
}
}
if (e(Input::get('supplier')) == '1') {
if (e( Input::get( 'supplier' ) ) == '1') {
if ($asset->supplier_id) {
$row[] = $asset->supplier->name;
$row[ ] = $asset->supplier->name;
} else {
$row[] = '';
$row[ ] = '';
}
}
if (e(Input::get('location')) == '1') {
if (($asset->assigned_to > 0) && ($asset->assigneduser->location_id > 0)) {
$location = Location::find($asset->assigneduser->location_id);
if (e( Input::get( 'location' ) ) == '1') {
if (( $asset->assigned_to > 0 ) && ( $asset->assigneduser->location_id > 0 )) {
$location = Location::find( $asset->assigneduser->location_id );
if ($location->name) {
$row[] = $location->name;
$row[ ] = $location->name;
} else {
$row[] = '';
$row[ ] = '';
}
} elseif ($asset->rtd_location_id) {
$location = Location::find($asset->rtd_location_id);
$location = Location::find( $asset->rtd_location_id );
if ($location->name) {
$row[] = $location->name;
$row[ ] = $location->name;
} else {
$row[] = '';
$row[ ] = '';
}
} else {
$row[] = ''; // Empty string if location is not set
$row[ ] = ''; // Empty string if location is not set
}
}
if (e(Input::get('assigned_to')) == '1') {
if (e( Input::get( 'assigned_to' ) ) == '1') {
if ($asset->assigned_to > 0) {
$user = User::find($asset->assigned_to);
$row[] = $user->fullName();
$user = User::find( $asset->assigned_to );
$row[ ] = $user->fullName();
} else {
$row[] = ''; // Empty string if unassigned
$row[ ] = ''; // Empty string if unassigned
}
}
if (e(Input::get('status')) == '1') {
if (($asset->status_id == '0') && ($asset->assigned_to == '0')) {
$row[] = Lang::get('general.ready_to_deploy');
} elseif (($asset->status_id == '') && ($asset->assigned_to == '0')) {
$row[] = Lang::get('general.pending');
if (e( Input::get( 'status' ) ) == '1') {
if (( $asset->status_id == '0' ) && ( $asset->assigned_to == '0' )) {
$row[ ] = Lang::get( 'general.ready_to_deploy' );
} elseif (( $asset->status_id == '' ) && ( $asset->assigned_to == '0' )) {
$row[ ] = Lang::get( 'general.pending' );
} elseif ($asset->assetstatus) {
$row[] = $asset->assetstatus->name;
$row[ ] = $asset->assetstatus->name;
} else {
$row[] = '';
$row[ ] = '';
}
}
if (e(Input::get('warranty')) == '1') {
if (e( Input::get( 'warranty' ) ) == '1') {
if ($asset->warranty_months) {
$row[] = $asset->warranty_months;
$row[] = $asset->warrantee_expires();
$row[ ] = $asset->warranty_months;
$row[ ] = $asset->warrantee_expires();
} else {
$row[] = '';
$row[] = '';
$row[ ] = '';
$row[ ] = '';
}
}
if (e(Input::get('depreciation')) == '1') {
if (e( Input::get( 'depreciation' ) ) == '1') {
$depreciation = $asset->getDepreciatedValue();
$row[] = '"'.number_format($asset->purchase_cost).'"';
$row[] = '"'.number_format($depreciation).'"';
$row[] = '"'.number_format($asset->purchase_cost - $depreciation).'"';
$row[ ] = '"' . number_format( $asset->purchase_cost ) . '"';
$row[ ] = '"' . number_format( $depreciation ) . '"';
$row[ ] = '"' . number_format( $asset->purchase_cost - $depreciation ) . '"';
}
$rows[] = implode($row, ',');
$rows[ ] = implode( $row, ',' );
}
// spit out a csv
if (array_filter($rows)) {
$csv = implode($rows, "\n");
$response = Response::make($csv, 200);
$response->header('Content-Type', 'text/csv');
$response->header('Content-disposition', 'attachment;filename=report.csv');
if (array_filter( $rows )) {
$csv = implode( $rows, "\n" );
$response = Response::make( $csv, 200 );
$response->header( 'Content-Type', 'text/csv' );
$response->header( 'Content-disposition', 'attachment;filename=report.csv' );
return $response;
} else {
return Redirect::to("reports/custom")->with('error', Lang::get('admin/reports/message.error'));
return Redirect::to( "reports/custom" )
->with( 'error', Lang::get( 'admin/reports/message.error' ) );
}
}
/**
* getImprovementsReport
*
* @return mixed
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0
*/
public function getAssetMaintenancesReport()
{
// Grab all the improvements
$assetMaintenances = \AssetMaintenance::with( 'asset', 'supplier' )
->orderBy( 'created_at', 'DESC' )
->get();
return View::make( 'backend/reports/asset_maintenances', compact( 'assetMaintenances' ) );
}
/**
* exportImprovementsReport
*
* @return \Illuminate\Http\Response
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0
*/
public function exportAssetMaintenancesReport()
{
// Grab all the improvements
$assetMaintenances = AssetMaintenance::with( 'asset', 'supplier' )
->orderBy( 'created_at', 'DESC' )
->get();
$rows = [ ];
$header = [
Lang::get( 'admin/asset_maintenances/table.asset_name' ),
Lang::get( 'admin/asset_maintenances/table.supplier_name' ),
Lang::get( 'admin/asset_maintenances/form.asset_maintenance_type' ),
Lang::get( 'admin/asset_maintenances/form.title' ),
Lang::get( 'admin/asset_maintenances/form.start_date' ),
Lang::get( 'admin/asset_maintenances/form.completion_date' ),
Lang::get( 'admin/asset_maintenances/form.asset_maintenance_time' ),
Lang::get( 'admin/asset_maintenances/form.cost' )
];
$header = array_map( 'trim', $header );
$rows[ ] = implode( $header, ',' );
foreach ($assetMaintenances as $assetMaintenance) {
$row = [ ];
$row[ ] = str_replace( ',', '', $assetMaintenance->asset->name );
$row[ ] = str_replace( ',', '', $assetMaintenance->supplier->name );
$row[ ] = $assetMaintenance->improvement_type;
$row[ ] = $assetMaintenance->title;
$row[ ] = $assetMaintenance->start_date;
$row[ ] = $assetMaintenance->completion_date;
if (is_null( $assetMaintenance->asset_maintenance_time )) {
$improvementTime = intval( Carbon::now()
->diffInDays( Carbon::parse( $assetMaintenance->start_date ) ) );
} else {
$improvementTime = intval( $assetMaintenance->asset_maintenance_time );
}
$row[ ] = $improvementTime;
$row[ ] = Lang::get( 'general.currency' ) . number_format( $assetMaintenance->cost, 2 );
$rows[ ] = implode( $row, ',' );
}
// spit out a csv
$csv = implode( $rows, "\n" );
$response = Response::make( $csv, 200 );
$response->header( 'Content-Type', 'text/csv' );
$response->header( 'Content-disposition', 'attachment;filename=report.csv' );
return $response;
}
}

View File

@@ -2,6 +2,7 @@
use AdminController;
use Image;
use AssetMaintenance;
use Input;
use Lang;
use Supplier;

View File

@@ -0,0 +1,65 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Lang;
class CreateAssetMaintenancesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create( 'asset_maintenances', function ( Blueprint $table ) {
$table->increments( 'id' );
$table->integer( 'asset_id' )
->unsigned();
$table->integer( 'supplier_id' )
->unsigned();
$table->enum( 'asset_maintenance_type', $this->getEnumFields() );
$table->string( 'title', 100 );
$table->boolean( 'is_warranty' );
$table->date( 'start_date' );
$table->date( 'completion_date' )
->nullable();
$table->integer( 'asset_maintenance_time' )
->nullable();
$table->longText( 'notes' )
->nullable();
$table->decimal( 'cost', 10, 2 )
->nullable();
$table->dateTime( 'deleted_at' )
->nullable();
$table->timestamps();
} );
}
protected function getEnumFields()
{
return [
Lang::get( 'admin/asset_maintenances/general.maintenance' ),
Lang::get( 'admin/asset_maintenances/general.repair' ),
Lang::get( 'admin/asset_maintenances/general.upgrade' )
];
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists( 'asset_maintenances' );
}
}

View File

@@ -0,0 +1,14 @@
<?php
return [
'asset_maintenance_type' => 'Asset Maintenance Type',
'title' => 'Title',
'start_date' => 'Start Date',
'completion_date' => 'Completion Date',
'cost' => 'Cost',
'is_warranty' => 'Warranty Improvement',
'asset_maintenance_time' => 'Asset Maintenance Time (in days)',
'notes' => 'Notes',
'update' => 'Update Asset Maintenance',
'create' => 'Create Asset Maintenance'
];

View File

@@ -0,0 +1,11 @@
<?php
return [
'asset_maintenances' => 'Asset Maintenances',
'edit' => 'Edit Asset Maintenance',
'delete' => 'Delete Asset Maintenance',
'view' => 'View Asset Maintenance Details',
'repair' => 'Repair',
'maintenance' => 'Maintenance',
'upgrade' => 'Upgrade'
];

View File

@@ -0,0 +1,17 @@
<?php
return [
'not_found' => 'Asset Maintenance you were looking for was not found!',
'delete' => [
'confirm' => 'Are you sure you wish to delete this asset maintenance?',
'error' => 'There was an issue deleting the asset maintenance. Please try again.',
'success' => 'The asset maintenance was deleted successfully.'
],
'create' => [
'error' => 'Asset Maintenance was not created, please try again.',
'success' => 'Asset Maintenance created successfully.'
],
'asset_maintenance_incomplete' => 'Not Completed Yet',
'warranty' => 'Warranty',
'not_warranty' => 'Not Warranty',
];

View File

@@ -0,0 +1,9 @@
<?php
return [
'title' => 'Asset Maintenance',
'asset_name' => 'Asset Name',
'supplier_name' => 'Supplier Name',
'is_warranty' => 'Warranty',
'dl_csv' => 'Download CSV'
];

View File

@@ -1,8 +1,6 @@
<?php
return array(
return [
'accessories' => 'Accessories',
'accessory' => 'Accessory',
'action' => 'Action',
@@ -61,6 +59,9 @@ return array(
'id' => 'ID',
'image_delete' => 'Delete Image',
'image_upload' => 'Upload Image',
'asset_maintenance' => 'Asset Maintenance',
'asset_maintenance_report' => 'Asset Maintenance Report',
'asset_maintenances' => 'Asset Maintenances',
'item' => 'Item',
'last' => 'Last',
'last_name' => 'Last Name',
@@ -131,5 +132,4 @@ return array(
'years' => 'years',
'yes' => 'Yes',
'zip' => 'Zip',
);
];

View File

@@ -7,7 +7,7 @@ class Asset extends Depreciable
protected $table = 'assets';
protected $errors;
protected $rules = array(
protected $rules = [
'name' => 'alpha_space|min:2|max:255',
'model_id' => 'required',
'status_id' => 'required',
@@ -20,7 +20,7 @@ class Asset extends Depreciable
'supplier_id' => 'integer',
'asset_tag' => 'required|alpha_space|min:3|max:255|unique:assets,asset_tag,{id}',
'status' => 'integer'
);
];
public function depreciation()
{
@@ -79,6 +79,21 @@ class Asset extends Depreciable
return $this->hasMany('Actionlog','asset_id')->where('asset_type','=','hardware')->orderBy('created_at', 'desc')->withTrashed();
}
/**
* assetmaintenances
* Get improvements for this asset
* @return mixed
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0
*/
public function assetmaintenances()
{
return $this->hasMany( 'AssetMaintenance', 'asset_id' )
->orderBy( 'created_at', 'desc' )
->withTrashed();
}
/**
* Get action logs for this asset
*/

View File

@@ -0,0 +1,84 @@
<?php
use Illuminate\Database\Eloquent\SoftDeletingTrait;
use Illuminate\Support\Facades\Lang;
class AssetMaintenance extends Elegant
{
use SoftDeletingTrait;
protected $dates = [ 'deleted_at' ];
protected $table = 'asset_maintenances';
// Declaring rules for form validation
protected $rules = [
'asset_id' => 'required|integer',
'supplier_id' => 'required|integer',
'asset_maintenance_type' => 'required',
'title' => 'required|max:100',
'is_warranty' => 'boolean',
'start_date' => 'required|date_format:Y-m-d',
'completion_date' => 'date_format:Y-m-d',
'notes' => 'string',
'cost' => 'numeric'
];
/**
* getImprovementOptions
*
* @return array
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0
*/
public static function getImprovementOptions()
{
return [
Lang::get( 'admin/asset_maintenances/general.maintenance' ) => Lang::get( 'admin/asset_maintenances/general.maintenance' ),
Lang::get( 'admin/asset_maintenances/general.repair' ) => Lang::get( 'admin/asset_maintenances/general.repair' ),
Lang::get( 'admin/asset_maintenances/general.upgrade' ) => Lang::get( 'admin/asset_maintenances/general.upgrade' )
];
}
/**
* asset
* Get asset for this improvement
*
* @return mixed
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0
*/
public function asset()
{
return $this->belongsTo( 'Asset', 'asset_id' )
->withTrashed();
}
public function supplier()
{
return $this->belongsTo( 'Supplier', 'supplier_id' )
->withTrashed();
}
/**
* -----------------------------------------------
* BEGIN QUERY SCOPES
* -----------------------------------------------
**/
/**
* Query builder scope for Deleted assets
*
* @param Illuminate\Database\Query\Builder $query Query builder instance
*
* @return Illuminate\Database\Query\Builder Modified query builder
*/
public function scopeDeleted( $query )
{
return $query->whereNotNull( 'deleted_at' );
}
}

View File

@@ -25,6 +25,11 @@ class Supplier extends Elegant
return $this->hasMany('Asset', 'supplier_id');
}
public function asset_maintenances()
{
return $this->hasMany('AssetMaintenance', 'supplier_id');
}
public function num_assets()
{
return $this->hasMany('Asset', 'supplier_id')->count();

View File

@@ -6,9 +6,9 @@
*/
Route::group(array('prefix' => 'api', 'namespace' => 'Controllers\Admin', 'before' => 'admin-auth'), function () {
/*---Hardware API---*/
Route::group(array('prefix' => 'hardware'), function() {
Route::group(['prefix' => 'hardware'], function() {
Route::resource('/', 'AssetsController');
Route::get('list/{status?}', array('as'=>'api.hardware.list', 'uses'=>'AssetsController@getDatatable'));
Route::get('list/{status?}', ['as'=>'api.hardware.list', 'uses'=>'AssetsController@getDatatable']);
});
/*---Status Label API---*/
@@ -24,10 +24,10 @@ Route::group(array('prefix' => 'api', 'namespace' => 'Controllers\Admin', 'befor
});
/*---Accessories API---*/
Route::group(array('prefix'=>'accessories'), function () {
Route::group(['prefix'=>'accessories'], function () {
Route::resource('/', 'AccessoriesController');
Route::get('list', array('as'=>'api.accessories.list', 'uses'=>'AccessoriesController@getDatatable'));
Route::get('{accessoryID}/view', array('as'=>'api.accessories.view', 'uses'=>'AccessoriesController@getDataView'));
Route::get('list', ['as'=>'api.accessories.list', 'uses'=>'AccessoriesController@getDatatable']);
Route::get('{accessoryID}/view', ['as'=>'api.accessories.view', 'uses'=>'AccessoriesController@getDataView']);
});
/*---Consumables API---*/
Route::group(array('prefix'=>'consumables'), function () {
@@ -36,16 +36,15 @@ Route::group(array('prefix' => 'api', 'namespace' => 'Controllers\Admin', 'befor
Route::get('{accessoryID}/view', array('as'=>'api.consumables.view', 'uses'=>'ConsumablesController@getDataView'));
});
/*---Users API---*/
Route::group(array('prefix'=>'users'), function() {
Route::group(['prefix'=>'users'], function() {
Route::resource('/', 'UsersController');
Route::get('list/{status?}', array('as'=>'api.users.list', 'uses'=>'UsersController@getDatatable'));
Route::get('list/{status?}', ['as'=>'api.users.list', 'uses'=>'UsersController@getDatatable']);
});
/*---Licenses API---*/
Route::group(array('prefix'=>'licenses'), function() {
Route::group(['prefix'=>'licenses'], function() {
Route::resource('/', 'LicensesController');
Route::get('list', array('as'=>'api.licenses.list', 'uses'=>'LicensesController@getDatatable'));
Route::get('list', ['as'=>'api.licenses.list', 'uses'=>'LicensesController@getDatatable']);
});
/*---Locations API---*/
Route::group(array('prefix'=>'locations'), function() {
Route::get('{locationID}/check', function ($locationID) {
@@ -53,8 +52,14 @@ Route::group(array('prefix' => 'api', 'namespace' => 'Controllers\Admin', 'befor
return $location;
});
});
/*---Improvements API---*/
Route::group( [ 'prefix' => 'asset_maintenances' ], function () {
Route::resource( '/', 'AssetMaintenancesController' );
Route::get( 'list', [ 'as' => 'api.asset_maintenances.list', 'uses' => 'AssetMaintenancesController@getDatatable' ] );
} );
/*---Models API---*/
Route::group(array('prefix'=>'models'), function() {
Route::group( [ 'prefix' => 'models'], function() {
Route::resource('/', 'ModelsController');
Route::get('list/{status?}', array('as'=>'api.models.list', 'uses'=>'ModelsController@getDatatable'));
Route::get('{modelId}/check', function ($modelId) {
@@ -62,13 +67,13 @@ Route::group(array('prefix' => 'api', 'namespace' => 'Controllers\Admin', 'befor
return $model->show_mac_address;
});
Route::get('{modelID}/view', array('as'=>'api.models.view', 'uses'=>'ModelsController@getDataView'));
Route::get('{modelID}/view', ['as'=>'api.models.view', 'uses'=>'ModelsController@getDataView']);
});
/*--- Categories API---*/
Route::group(array('prefix'=>'categories'), function() {
Route::group(['prefix'=>'categories'], function() {
Route::resource('/', 'CategoriesController');
Route::get('list', array('as'=>'api.categories.list', 'uses'=>'CategoriesController@getDatatable'));
Route::get('{categoryID}/view', array('as'=>'api.categories.view', 'uses'=>'CategoriesController@getDataView'));
Route::get('list', ['as'=>'api.categories.list', 'uses'=>'CategoriesController@getDatatable']);
Route::get('{categoryID}/view', ['as'=>'api.categories.view', 'uses'=>'CategoriesController@getDataView']);
});
});
@@ -163,42 +168,58 @@ Route::group(array('prefix' => 'admin', 'before' => 'admin-auth', 'namespace' =>
# Licenses
Route::group(array('prefix' => 'licenses'), function () {
Route::group(['prefix' => 'licenses'], function () {
Route::get('create', array('as' => 'create/licenses', 'uses' => 'LicensesController@getCreate'));
Route::get('create', ['as' => 'create/licenses', 'uses' => 'LicensesController@getCreate']);
Route::post('create', 'LicensesController@postCreate');
Route::get('{licenseId}/edit', array('as' => 'update/license', 'uses' => 'LicensesController@getEdit'));
Route::get('{licenseId}/edit', ['as' => 'update/license', 'uses' => 'LicensesController@getEdit']);
Route::post('{licenseId}/edit', 'LicensesController@postEdit');
Route::get('{licenseId}/clone', array('as' => 'clone/license', 'uses' => 'LicensesController@getClone'));
Route::get('{licenseId}/clone', ['as' => 'clone/license', 'uses' => 'LicensesController@getClone']);
Route::post('{licenseId}/clone', 'LicensesController@postCreate');
Route::get('{licenseId}/delete', array('as' => 'delete/license', 'uses' => 'LicensesController@getDelete'));
Route::get('{licenseId}/freecheckout', array('as' => 'freecheckout/license', 'uses' => 'LicensesController@getFreeLicense'));
Route::get('{licenseId}/checkout', array('as' => 'checkout/license', 'uses' => 'LicensesController@getCheckout'));
Route::post('{licenseId}/checkout', 'LicensesController@postCheckout');
Route::get('{licenseId}/checkin/{backto?}', array('as' => 'checkin/license', 'uses' => 'LicensesController@getCheckin'));
Route::get('{licenseId}/checkin/{backto?}', ['as' => 'checkin/license', 'uses' => 'LicensesController@getCheckin']);
Route::post('{licenseId}/checkin/{backto?}', 'LicensesController@postCheckin');
Route::get('{licenseId}/view', array('as' => 'view/license', 'uses' => 'LicensesController@getView'));
Route::post('{licenseId}/upload', array('as' => 'upload/license', 'uses' => 'LicensesController@postUpload'));
Route::get('{licenseId}/deletefile/{fileId}', array('as' => 'delete/licensefile', 'uses' => 'LicensesController@getDeleteFile'));
Route::get('{licenseId}/showfile/{fileId}', array('as' => 'show/licensefile', 'uses' => 'LicensesController@displayFile'));
Route::get('/', array('as' => 'licenses', 'uses' => 'LicensesController@getIndex'));
Route::get('{licenseId}/view', ['as' => 'view/license', 'uses' => 'LicensesController@getView']);
Route::post('{licenseId}/upload', ['as' => 'upload/license', 'uses' => 'LicensesController@postUpload']);
Route::get('{licenseId}/deletefile/{fileId}', ['as' => 'delete/licensefile', 'uses' => 'LicensesController@getDeleteFile']);
Route::get('{licenseId}/showfile/{fileId}', ['as' => 'show/licensefile', 'uses' => 'LicensesController@displayFile']);
Route::get('/', ['as' => 'licenses', 'uses' => 'LicensesController@getIndex']);
});
# Accessories
Route::group(array('prefix' => 'accessories'), function () {
# Asset Maintenances
Route::group( [ 'prefix' => 'asset_maintenances' ], function () {
Route::get('create', array('as' => 'create/accessory', 'uses' => 'AccessoriesController@getCreate'));
Route::get( 'create/{assetId?}',
[ 'as' => 'create/asset_maintenances', 'uses' => 'AssetMaintenancesController@getCreate' ] );
Route::post( 'create/{assetId?}', 'AssetMaintenancesController@postCreate' );
Route::get( '/', [ 'as' => 'asset_maintenances', 'uses' => 'AssetMaintenancesController@getIndex' ] );
Route::get( '{assetMaintenanceId}/edit',
[ 'as' => 'update/asset_maintenance', 'uses' => 'AssetMaintenancesController@getEdit' ] );
Route::post( '{assetMaintenanceId}/edit', 'AssetMaintenancesController@postEdit' );
Route::get( '{assetMaintenanceId}/delete',
[ 'as' => 'delete/asset_maintenance', 'uses' => 'AssetMaintenancesController@getDelete' ] );
Route::get( '{assetMaintenanceId}/view',
[ 'as' => 'view/asset_maintenance', 'uses' => 'AssetMaintenancesController@getView' ] );
} );
# Accessories
Route::group( [ 'prefix' => 'accessories' ], function () {
Route::get('create', ['as' => 'create/accessory', 'uses' => 'AccessoriesController@getCreate']);
Route::post('create', 'AccessoriesController@postCreate');
Route::get('{accessoryID}/edit', array('as' => 'update/accessory', 'uses' => 'AccessoriesController@getEdit'));
Route::get('{accessoryID}/edit', ['as' => 'update/accessory', 'uses' => 'AccessoriesController@getEdit']);
Route::post('{accessoryID}/edit', 'AccessoriesController@postEdit');
Route::get('{accessoryID}/delete', array('as' => 'delete/accessory', 'uses' => 'AccessoriesController@getDelete'));
Route::get('{accessoryID}/view', array('as' => 'view/accessory', 'uses' => 'AccessoriesController@getView'));
Route::get('{accessoryID}/checkout', array('as' => 'checkout/accessory', 'uses' => 'AccessoriesController@getCheckout'));
Route::get('{accessoryID}/delete', ['as' => 'delete/accessory', 'uses' => 'AccessoriesController@getDelete']);
Route::get('{accessoryID}/view', ['as' => 'view/accessory', 'uses' => 'AccessoriesController@getView']);
Route::get('{accessoryID}/checkout', ['as' => 'checkout/accessory', 'uses' => 'AccessoriesController@getCheckout']);
Route::post('{accessoryID}/checkout', 'AccessoriesController@postCheckout');
Route::get('{accessoryID}/checkin/{backto?}', array('as' => 'checkin/accessory', 'uses' => 'AccessoriesController@getCheckin'));
Route::get('{accessoryID}/checkin/{backto?}', ['as' => 'checkin/accessory', 'uses' => 'AccessoriesController@getCheckin']);
Route::post('{accessoryID}/checkin/{backto?}', 'AccessoriesController@postCheckin');
Route::get('/', array('as' => 'accessories', 'uses' => 'AccessoriesController@getIndex'));
Route::get('/', ['as' => 'accessories', 'uses' => 'AccessoriesController@getIndex']);
});
@@ -222,9 +243,9 @@ Route::group(array('prefix' => 'admin', 'before' => 'admin-auth', 'namespace' =>
Route::group(array('prefix' => 'settings','before' => 'admin-auth'), function () {
# Settings
Route::group(array('prefix' => 'app'), function () {
Route::get('/', array('as' => 'app', 'uses' => 'SettingsController@getIndex'));
Route::get('edit', array('as' => 'edit/settings', 'uses' => 'SettingsController@getEdit'));
Route::group(['prefix' => 'app'], function () {
Route::get('/', ['as' => 'app', 'uses' => 'SettingsController@getIndex']);
Route::get('edit', ['as' => 'edit/settings', 'uses' => 'SettingsController@getEdit']);
Route::post('edit', 'SettingsController@postEdit');
});
@@ -236,67 +257,67 @@ Route::group(array('prefix' => 'admin', 'before' => 'admin-auth', 'namespace' =>
# Manufacturers
Route::group(array('prefix' => 'manufacturers'), function () {
Route::get('/', array('as' => 'manufacturers', 'uses' => 'ManufacturersController@getIndex'));
Route::get('create', array('as' => 'create/manufacturer', 'uses' => 'ManufacturersController@getCreate'));
Route::group(['prefix' => 'manufacturers'], function () {
Route::get('/', ['as' => 'manufacturers', 'uses' => 'ManufacturersController@getIndex']);
Route::get('create', ['as' => 'create/manufacturer', 'uses' => 'ManufacturersController@getCreate']);
Route::post('create', 'ManufacturersController@postCreate');
Route::get('{manufacturerId}/edit', array('as' => 'update/manufacturer', 'uses' => 'ManufacturersController@getEdit'));
Route::get('{manufacturerId}/edit', ['as' => 'update/manufacturer', 'uses' => 'ManufacturersController@getEdit']);
Route::post('{manufacturerId}/edit', 'ManufacturersController@postEdit');
Route::get('{manufacturerId}/delete', array('as' => 'delete/manufacturer', 'uses' => 'ManufacturersController@getDelete'));
Route::get('{manufacturerId}/view', array('as' => 'view/manufacturer', 'uses' => 'ManufacturersController@getView'));
Route::get('{manufacturerId}/delete', ['as' => 'delete/manufacturer', 'uses' => 'ManufacturersController@getDelete']);
Route::get('{manufacturerId}/view', ['as' => 'view/manufacturer', 'uses' => 'ManufacturersController@getView']);
});
# Suppliers
Route::group(array('prefix' => 'suppliers'), function () {
Route::get('/', array('as' => 'suppliers', 'uses' => 'SuppliersController@getIndex'));
Route::get('create', array('as' => 'create/supplier', 'uses' => 'SuppliersController@getCreate'));
Route::group(['prefix' => 'suppliers'], function () {
Route::get('/', ['as' => 'suppliers', 'uses' => 'SuppliersController@getIndex']);
Route::get('create', ['as' => 'create/supplier', 'uses' => 'SuppliersController@getCreate']);
Route::post('create', 'SuppliersController@postCreate');
Route::get('{supplierId}/edit', array('as' => 'update/supplier', 'uses' => 'SuppliersController@getEdit'));
Route::get('{supplierId}/edit', ['as' => 'update/supplier', 'uses' => 'SuppliersController@getEdit']);
Route::post('{supplierId}/edit', 'SuppliersController@postEdit');
Route::get('{supplierId}/delete', array('as' => 'delete/supplier', 'uses' => 'SuppliersController@getDelete'));
Route::get('{supplierId}/view', array('as' => 'view/supplier', 'uses' => 'SuppliersController@getView'));
Route::get('{supplierId}/delete', ['as' => 'delete/supplier', 'uses' => 'SuppliersController@getDelete']);
Route::get('{supplierId}/view', ['as' => 'view/supplier', 'uses' => 'SuppliersController@getView']);
});
# Categories
Route::group(array('prefix' => 'categories'), function () {
Route::get('create', array('as' => 'create/category', 'uses' => 'CategoriesController@getCreate'));
Route::group(['prefix' => 'categories'], function () {
Route::get('create', ['as' => 'create/category', 'uses' => 'CategoriesController@getCreate']);
Route::post('create', 'CategoriesController@postCreate');
Route::get('{categoryId}/edit', array('as' => 'update/category', 'uses' => 'CategoriesController@getEdit'));
Route::get('{categoryId}/edit', ['as' => 'update/category', 'uses' => 'CategoriesController@getEdit']);
Route::post('{categoryId}/edit', 'CategoriesController@postEdit');
Route::get('{categoryId}/delete', array('as' => 'delete/category', 'uses' => 'CategoriesController@getDelete'));
Route::get('{categoryId}/view', array('as' => 'view/category', 'uses' => 'CategoriesController@getView'));
Route::get('/', array('as' => 'categories', 'uses' => 'CategoriesController@getIndex'));
Route::get('{categoryId}/delete', ['as' => 'delete/category', 'uses' => 'CategoriesController@getDelete']);
Route::get('{categoryId}/view', ['as' => 'view/category', 'uses' => 'CategoriesController@getView']);
Route::get('/', ['as' => 'categories', 'uses' => 'CategoriesController@getIndex']);
});
# Depreciations
Route::group(array('prefix' => 'depreciations'), function () {
Route::get('/', array('as' => 'depreciations', 'uses' => 'DepreciationsController@getIndex'));
Route::get('create', array('as' => 'create/depreciations', 'uses' => 'DepreciationsController@getCreate'));
Route::group(['prefix' => 'depreciations'], function () {
Route::get('/', ['as' => 'depreciations', 'uses' => 'DepreciationsController@getIndex']);
Route::get('create', ['as' => 'create/depreciations', 'uses' => 'DepreciationsController@getCreate']);
Route::post('create', 'DepreciationsController@postCreate');
Route::get('{depreciationId}/edit', array('as' => 'update/depreciations', 'uses' => 'DepreciationsController@getEdit'));
Route::get('{depreciationId}/edit', ['as' => 'update/depreciations', 'uses' => 'DepreciationsController@getEdit']);
Route::post('{depreciationId}/edit', 'DepreciationsController@postEdit');
Route::get('{depreciationId}/delete', array('as' => 'delete/depreciations', 'uses' => 'DepreciationsController@getDelete'));
Route::get('{depreciationId}/delete', ['as' => 'delete/depreciations', 'uses' => 'DepreciationsController@getDelete']);
});
# Locations
Route::group(array('prefix' => 'locations'), function () {
Route::get('/', array('as' => 'locations', 'uses' => 'LocationsController@getIndex'));
Route::get('create', array('as' => 'create/location', 'uses' => 'LocationsController@getCreate'));
Route::group(['prefix' => 'locations'], function () {
Route::get('/', ['as' => 'locations', 'uses' => 'LocationsController@getIndex']);
Route::get('create', ['as' => 'create/location', 'uses' => 'LocationsController@getCreate']);
Route::post('create', 'LocationsController@postCreate');
Route::get('{locationId}/edit', array('as' => 'update/location', 'uses' => 'LocationsController@getEdit'));
Route::get('{locationId}/edit', ['as' => 'update/location', 'uses' => 'LocationsController@getEdit']);
Route::post('{locationId}/edit', 'LocationsController@postEdit');
Route::get('{locationId}/delete', array('as' => 'delete/location', 'uses' => 'LocationsController@getDelete'));
Route::get('{locationId}/delete', ['as' => 'delete/location', 'uses' => 'LocationsController@getDelete']);
});
# Status Labels
Route::group(array('prefix' => 'statuslabels'), function () {
Route::get('/', array('as' => 'statuslabels', 'uses' => 'StatuslabelsController@getIndex'));
Route::get('create', array('as' => 'create/statuslabel', 'uses' => 'StatuslabelsController@getCreate'));
Route::group(['prefix' => 'statuslabels'], function () {
Route::get('/', ['as' => 'statuslabels', 'uses' => 'StatuslabelsController@getIndex']);
Route::get('create', ['as' => 'create/statuslabel', 'uses' => 'StatuslabelsController@getCreate']);
Route::post('create', 'StatuslabelsController@postCreate');
Route::get('{statuslabelId}/edit', array('as' => 'update/statuslabel', 'uses' => 'StatuslabelsController@getEdit'));
Route::get('{statuslabelId}/edit', ['as' => 'update/statuslabel', 'uses' => 'StatuslabelsController@getEdit']);
Route::post('{statuslabelId}/edit', 'StatuslabelsController@postEdit');
Route::get('{statuslabelId}/delete', array('as' => 'delete/statuslabel', 'uses' => 'StatuslabelsController@getDelete'));
Route::get('{statuslabelId}/delete', ['as' => 'delete/statuslabel', 'uses' => 'StatuslabelsController@getDelete']);
});
@@ -309,11 +330,11 @@ Route::group(array('prefix' => 'admin', 'before' => 'admin-auth', 'namespace' =>
Route::get('create', array('as' => 'create/user', 'uses' => 'UsersController@getCreate'));
Route::post('create', 'UsersController@postCreate');
Route::get('import', array('as' => 'import/user', 'uses' => 'UsersController@getImport'));
Route::get('import', ['as' => 'import/user', 'uses' => 'UsersController@getImport']);
Route::post('import', 'UsersController@postImport');
Route::get('{userId}/edit', array('as' => 'update/user', 'uses' => 'UsersController@getEdit'));
Route::get('{userId}/edit', ['as' => 'update/user', 'uses' => 'UsersController@getEdit']);
Route::post('{userId}/edit', 'UsersController@postEdit');
Route::get('{userId}/clone', array('as' => 'clone/user', 'uses' => 'UsersController@getClone'));
Route::get('{userId}/clone', ['as' => 'clone/user', 'uses' => 'UsersController@getClone']);
Route::post('{userId}/clone', 'UsersController@postCreate');
Route::get('{userId}/delete', array('as' => 'delete/user', 'uses' => 'UsersController@getDelete'));
Route::get('{userId}/restore', array('as' => 'restore/user', 'uses' => 'UsersController@getRestore'));
@@ -336,19 +357,19 @@ Route::group(array('prefix' => 'admin', 'before' => 'admin-auth', 'namespace' =>
});
# Group Management
Route::group(array('prefix' => 'groups'), function () {
Route::get('/', array('as' => 'groups', 'uses' => 'GroupsController@getIndex'));
Route::get('create', array('as' => 'create/group', 'uses' => 'GroupsController@getCreate'));
Route::group(['prefix' => 'groups'], function () {
Route::get('/', ['as' => 'groups', 'uses' => 'GroupsController@getIndex']);
Route::get('create', ['as' => 'create/group', 'uses' => 'GroupsController@getCreate']);
Route::post('create', 'GroupsController@postCreate');
Route::get('{groupId}/edit', array('as' => 'update/group', 'uses' => 'GroupsController@getEdit'));
Route::get('{groupId}/edit', ['as' => 'update/group', 'uses' => 'GroupsController@getEdit']);
Route::post('{groupId}/edit', 'GroupsController@postEdit');
Route::get('{groupId}/delete', array('as' => 'delete/group', 'uses' => 'GroupsController@getDelete'));
Route::get('{groupId}/restore', array('as' => 'restore/group', 'uses' => 'GroupsController@getRestore'));
Route::get('{groupId}/view', array('as' => 'view/group', 'uses' => 'GroupsController@getView'));
Route::get('{groupId}/delete', ['as' => 'delete/group', 'uses' => 'GroupsController@getDelete']);
Route::get('{groupId}/restore', ['as' => 'restore/group', 'uses' => 'GroupsController@getRestore']);
Route::get('{groupId}/view', ['as' => 'view/group', 'uses' => 'GroupsController@getView']);
});
# Dashboard
Route::get('/', array('as' => 'admin', 'uses' => 'DashboardController@getIndex'));
Route::get('/', ['as' => 'admin', 'uses' => 'DashboardController@getIndex']);
});
@@ -407,53 +428,104 @@ Route::group(array('prefix' => 'account', 'before' => 'auth', 'namespace' => 'Co
Route::get('change-password', array('as' => 'change-password', 'uses' => 'ChangePasswordController@getIndex'));
Route::post('change-password', 'ChangePasswordController@postIndex');
# View Assets
Route::get('view-assets', array('as' => 'view-assets', 'uses' => 'ViewAssetsController@getIndex'));
# Change Email
Route::get('change-email', array('as' => 'change-email', 'uses' => 'ChangeEmailController@getIndex'));
Route::post('change-email', 'ChangeEmailController@postIndex');
# Register
#Route::get('signup', array('as' => 'signup', 'uses' => 'AuthController@getSignup'));
Route::post( 'signup', 'AuthController@postSignup' );
# Accept Asset
Route::get('accept-asset/{logID}', array('as' => 'account/accept-assets', 'uses' => 'ViewAssetsController@getAcceptAsset'));
Route::post('accept-asset/{logID}', array('as' => 'account/asset-accepted', 'uses' => 'ViewAssetsController@postAcceptAsset'));
# Account Activation
Route::get( 'activate/{activationCode}', [ 'as' => 'activate', 'uses' => 'AuthController@getActivate' ] );
# Profile
Route::get('requestable-assets', array('as' => 'requestable-assets', 'uses' => 'ViewAssetsController@getRequestableIndex'));
Route::get('request-asset/{assetId}', array('as' => 'account/request-asset', 'uses' => 'ViewAssetsController@getRequestAsset'));
# Forgot Password
Route::get( 'forgot-password', [ 'as' => 'forgot-password', 'uses' => 'AuthController@getForgotPassword' ] );
Route::post( 'forgot-password', 'AuthController@postForgotPassword' );
# Account Dashboard
Route::get('/', array('as' => 'account', 'uses' => 'DashboardController@getIndex'));
# Forgot Password Confirmation
Route::get( 'forgot-password/{passwordResetCode}',
[ 'as' => 'forgot-password-confirm', 'uses' => 'AuthController@getForgotPasswordConfirm' ] );
Route::post( 'forgot-password/{passwordResetCode}', 'AuthController@postForgotPasswordConfirm' );
# Logout
Route::get( 'logout', [ 'as' => 'logout', 'uses' => 'AuthController@getLogout' ] );
});
} );
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
/*
|--------------------------------------------------------------------------
| Account Routes
|--------------------------------------------------------------------------
|
|
|
*/
Route::group(array('before' => 'reporting-auth', 'namespace' => 'Controllers\Admin'), function () {
Route::group( [ 'prefix' => 'account', 'before' => 'auth', 'namespace' => 'Controllers\Account' ], function () {
Route::get('reports/depreciation', array('as' => 'reports/depreciation', 'uses' => 'ReportsController@getDeprecationReport'));
Route::get('reports/export/depreciation', array('as' => 'reports/export/depreciation', 'uses' => 'ReportsController@exportDeprecationReport'));
Route::get('reports/licenses', array('as' => 'reports/licenses', 'uses' => 'ReportsController@getLicenseReport'));
Route::get('reports/export/licenses', array('as' => 'reports/export/licenses', 'uses' => 'ReportsController@exportLicenseReport'));
Route::get('reports/assets', array('as' => 'reports/assets', 'uses' => 'ReportsController@getAssetsReport'));
Route::get('reports/export/assets', array('as' => 'reports/export/assets', 'uses' => 'ReportsController@exportAssetReport'));
# Profile
Route::get( 'profile', [ 'as' => 'profile', 'uses' => 'ProfileController@getIndex' ] );
Route::post( 'profile', 'ProfileController@postIndex' );
Route::get('reports/custom', array('as' => 'reports/custom', 'uses' => 'ReportsController@getCustomReport'));
Route::post('reports/custom', 'ReportsController@postCustom');
# Change Password
Route::get( 'change-password', [ 'as' => 'change-password', 'uses' => 'ChangePasswordController@getIndex' ] );
Route::post( 'change-password', 'ChangePasswordController@postIndex' );
Route::get('reports/activity', array('as' => 'reports/activity', 'uses' => 'ReportsController@getActivityReport'));
});
# View Assets
Route::get( 'view-assets', [ 'as' => 'view-assets', 'uses' => 'ViewAssetsController@getIndex' ] );
# Change Email
Route::get( 'change-email', [ 'as' => 'change-email', 'uses' => 'ChangeEmailController@getIndex' ] );
Route::post( 'change-email', 'ChangeEmailController@postIndex' );
# Accept Asset
Route::get( 'accept-asset/{logID}',
[ 'as' => 'account/accept-assets', 'uses' => 'ViewAssetsController@getAcceptAsset' ] );
Route::post( 'accept-asset/{logID}',
[ 'as' => 'account/asset-accepted', 'uses' => 'ViewAssetsController@postAcceptAsset' ] );
Route::get('/', array('as' => 'home', 'before' => 'admin-auth', 'uses' => 'Controllers\Admin\DashboardController@getIndex'));
# Profile
Route::get( 'requestable-assets',
[ 'as' => 'requestable-assets', 'uses' => 'ViewAssetsController@getRequestableIndex' ] );
Route::get( 'request-asset/{assetId}',
[ 'as' => 'account/request-asset', 'uses' => 'ViewAssetsController@getRequestAsset' ] );
# Account Dashboard
Route::get( '/', [ 'as' => 'account', 'uses' => 'DashboardController@getIndex' ] );
} );
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::group( [ 'before' => 'reporting-auth', 'namespace' => 'Controllers\Admin' ], function () {
Route::get( 'reports/depreciation',
[ 'as' => 'reports/depreciation', 'uses' => 'ReportsController@getDeprecationReport' ] );
Route::get( 'reports/export/depreciation',
[ 'as' => 'reports/export/depreciation', 'uses' => 'ReportsController@exportDeprecationReport' ] );
Route::get( 'reports/asset_maintenances',
[ 'as' => 'reports/asset_maintenances', 'uses' => 'ReportsController@getAssetMaintenancesReport' ] );
Route::get( 'reports/export/asset_maintenances',
[ 'as' => 'reports/export/asset_maintenances', 'uses' => 'ReportsController@exportAssetMaintenancesReport' ] );
Route::get( 'reports/licenses',
[ 'as' => 'reports/licenses', 'uses' => 'ReportsController@getLicenseReport' ] );
Route::get( 'reports/export/licenses',
[ 'as' => 'reports/export/licenses', 'uses' => 'ReportsController@exportLicenseReport' ] );
Route::get( 'reports/assets', [ 'as' => 'reports/assets', 'uses' => 'ReportsController@getAssetsReport' ] );
Route::get( 'reports/export/assets',
[ 'as' => 'reports/export/assets', 'uses' => 'ReportsController@exportAssetReport' ] );
Route::get( 'reports/custom', [ 'as' => 'reports/custom', 'uses' => 'ReportsController@getCustomReport' ] );
Route::post( 'reports/custom', 'ReportsController@postCustom' );
Route::get( 'reports/activity',
[ 'as' => 'reports/activity', 'uses' => 'ReportsController@getActivityReport' ] );
} );
Route::get('/', array('as' => 'home', 'before' => 'admin-auth', 'uses' => 'Controllers\Admin\DashboardController@getIndex'));

View File

@@ -0,0 +1,146 @@
@extends('backend/layouts/default')
{{-- Page title --}}
@section('title')
@if ($assetMaintenance->id)
@lang('admin/asset_maintenances/form.update') ::
@else
@lang('admin/asset_maintenances/form.create') ::
@endif
@parent
@stop
{{-- Page content --}}
@section('content')
<div class="row header">
<div class="col-md-12">
<a href="{{ URL::previous() }}" class="btn-flat gray pull-right right">
<i class="fa fa-arrow-left icon-white"></i> @lang('general.back')</a>
<h3>
@if ($assetMaintenance->id)
@lang('admin/asset_maintenances/form.update')
@else
@lang('admin/asset_maintenances/form.create')
@endif
</h3>
</div>
</div>
<div class="row form-wrapper">
<form class="form-horizontal" method="post" action="" autocomplete="off">
<!-- CSRF Token -->
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
<!-- Asset -->
<div class="form-group {{ $errors->has('asset_id') ? ' has-error' : '' }}">
<label for="asset_id" class="col-md-3 control-label">@lang('admin/asset_maintenances/table.asset_name')
<i class='fa fa-asterisk'></i></label>
<div class="col-md-7">
@if ($selectedAsset == null)
{{ Form::select('asset_id', $asset_list , Input::old('asset_id', $assetMaintenance->asset_id), ['class'=>'select2', 'style'=>'min-width:350px']) }}
@else
{{ Form::select('asset_id', $asset_list , Input::old('asset_id', $selectedAsset), ['class'=>'select2', 'style'=>'min-width:350px', 'enabled' => 'false']) }}
@endif
{{ $errors->first('asset_id', '<br><span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
<!-- Supplier -->
<div class="form-group {{ $errors->has('supplier_id') ? ' has-error' : '' }}">
<label for="supplier_id" class="col-md-3 control-label">@lang('admin/asset_maintenances/table.supplier_name')</label>
<div class="col-md-7">
{{ Form::select('supplier_id', $supplier_list , Input::old('supplier_id', $assetMaintenance->supplier_id), ['class'=>'select2', 'style'=>'min-width:350px']) }}
{{ $errors->first('supplier_id', '<br><span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
<!-- Improvement Type -->
<div class="form-group {{ $errors->has('asset_maintenance_type') ? ' has-error' : '' }}">
<label for="asset_maintenance_type" class="col-md-3 control-label">@lang('admin/asset_maintenances/form.asset_maintenance_type')
<i class='fa fa-asterisk'></i></label>
<div class="col-md-7">
{{ Form::select('asset_maintenance_type', $assetMaintenanceType , Input::old('asset_maintenance_type', $assetMaintenance->asset_maintenance_type), ['class'=>'select2', 'style'=>'min-width:350px']) }}
{{ $errors->first('asset_maintenance_type', '<br><span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
<!-- Title -->
<div class="form-group {{ $errors->has('title') ? ' has-error' : '' }}">
<label for="title" class="col-md-3 control-label">@lang('admin/asset_maintenances/form.title')
<i class='fa fa-asterisk'></i></label>
</label>
<div class="col-md-7">
<input class="form-control" type="text" name="title" id="title" value="{{ Input::old('title', $assetMaintenance->title) }}" />
{{ $errors->first('title', '<br><span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
<!-- Start Date -->
<div class="form-group {{ $errors->has('start_date') ? ' has-error' : '' }}">
<label for="start_date" class="col-md-3 control-label">@lang('admin/asset_maintenances/form.start_date')
<i class='fa fa-asterisk'></i></label>
<div class="input-group col-md-2">
<input type="date" class="datepicker form-control" data-date-format="yyyy-mm-dd" placeholder="Select Date" name="start_date" id="start_date" value="{{ Input::old('start_date', $assetMaintenance->start_date) }}">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
{{ $errors->first('start_date', '<br><span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
<!-- Completion Date -->
<div class="form-group {{ $errors->has('completion_date') ? ' has-error' : '' }}">
<label for="start_date" class="col-md-3 control-label">@lang('admin/asset_maintenances/form.completion_date')</label>
<div class="input-group col-md-2">
<input type="date" class="datepicker form-control" data-date-format="yyyy-mm-dd" placeholder="Select Date" name="completion_date" id="completion_date" value="{{ Input::old('completion_date', $assetMaintenance->completion_date) }}">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
{{ $errors->first('completion_date', '<br><span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
<!-- Warranty -->
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
<div class="checkbox">
<label>
<input type="checkbox" value="1" name="is_warranty" id="is_warranty" {{ Input::old('is_warranty', $assetMaintenance->is_warranty) == '1' ? ' checked="checked"' : '' }}> @lang('admin/asset_maintenances/form.is_warranty')
</label>
</div>
</div>
</div>
<!-- Asset Maintenance Cost -->
<div class="form-group {{ $errors->has('cost') ? ' has-error' : '' }}">
<label for="cost" class="col-md-3 control-label">@lang('admin/asset_maintenances/form.cost')</label>
<div class="col-md-2">
<div class="input-group">
<span class="input-group-addon">@lang('general.currency')</span>
<input class="col-md-2 form-control" type="text" name="cost" id="cost" value="{{ Input::old('cost', number_format($assetMaintenance->cost,2)) }}" />
{{ $errors->first('cost', '<br><span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
</div>
<!-- Notes -->
<div class="form-group {{ $errors->has('notes') ? ' has-error' : '' }}">
<label for="notes" class="col-md-3 control-label">@lang('admin/asset_maintenances/form.notes')</label>
<div class="col-md-7">
<textarea class="col-md-6 form-control" id="notes" name="notes">{{{ Input::old('notes', $assetMaintenance->notes) }}}</textarea>
{{ $errors->first('notes', '<br><span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
<!-- Form actions -->
<div class="form-group">
<label class="col-md-3 control-label"></label>
<div class="col-md-7">
<a class="btn btn-link" href="{{ URL::previous() }}">@lang('button.cancel')</a>
<button type="submit" class="btn btn-success"><i class="fa fa-check icon-white"></i> @lang('general.save')</button>
</div>
</div>
</form>
</div>
@stop

View File

@@ -0,0 +1,56 @@
@extends('backend/layouts/default')
{{-- Page title --}}
@lang('admin/asset_maintenances/general.improvements') ::
@parent
@stop
{{-- Page content --}}
@section('content')
<div class="row header">
<div class="col-md-12">
<a href="{{ route('create/asset_maintenances') }}" class="btn btn-success pull-right"><i class="fa fa-plus icon-white"></i> Create New</a>
<h3>@lang('admin/asset_maintenances/general.asset_maintenances')</h3>
</div>
</div>
<div class="row form-wrapper">
{{ Datatable::table()
->addColumn(Lang::get('admin/asset_maintenances/table.asset_name'),
Lang::get('admin/asset_maintenances/table.supplier_name'),
Lang::get('admin/asset_maintenances/form.asset_maintenance_type'),
Lang::get('admin/asset_maintenances/form.title'),
Lang::get('admin/asset_maintenances/form.start_date'),
Lang::get('admin/asset_maintenances/form.completion_date'),
Lang::get('admin/asset_maintenances/form.asset_maintenance_time'),
Lang::get('admin/asset_maintenances/form.cost'),
Lang::get('table.actions'))
->setOptions(
[
'language' => [
'search' => Lang::get('general.search'),
'lengthMenu' => Lang::get('general.page_menu'),
'loadingRecords' => Lang::get('general.loading'),
'zeroRecords' => Lang::get('general.no_results'),
'info' => Lang::get('general.pagination_info'),
'processing' => Lang::get('general.processing'),
'paginate'=> [
'first'=>Lang::get('general.first'),
'previous'=>Lang::get('general.previous'),
'next'=>Lang::get('general.next'),
'last'=>Lang::get('general.last'),
],
],
'sAjaxSource'=>route('api.asset_maintenances.list'),
'dom' =>'CT<"clear">lfrtip',
'colVis'=> ['showAll'=>'Show All','restore'=>'Restore','activate'=>'mouseover'],
'columnDefs'=> [
['bSortable'=>false,'targets'=>[8]],
['width'=>'12%','targets'=>[8]],
],
'order'=>[[0,'asc']],
]
)
->render() }}
</div>
@stop

View File

@@ -0,0 +1,110 @@
<?php
use Carbon\Carbon;
?>
@extends('backend/layouts/default')
{{-- Page title --}}
@section('title')
@lang('admin/asset_maintenances/general.view') {{ $assetMaintenance->title }} ::
@parent
@stop
{{-- Page content --}}
@section('content')
<div class="row header">
<div class="col-md-12">
<h3 class="title">
@lang('admin/asset_maintenances/general.view')
{{{ " - " . $assetMaintenance->title }}}
</h3>
<div class="btn-group pull-right">
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">@lang('button.actions')
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dropdownMenu1">
<li role="presentation"><a href="{{ route('update/asset_maintenance', $assetMaintenance->id) }}">@lang('admin/asset_maintenances/general.edit')</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="user-profile ">
<div class="row profile">
<div class="col-md-9 bio">
<!-- 1st Row Begin -->
<div class="row">
<div class="col-md-12 col-sm-12" style="padding-bottom: 10px; margin-left: 15px; word-wrap: break-word;">
<strong>@lang('admin/asset_maintenances/form.asset_maintenance_type'): </strong>
{{{ $assetMaintenance->asset_maintenance_type }}}
</div>
</div>
<!-- 1st Row End -->
<!-- 2nd Row Begin -->
<div class="row">
<div class="col-md-3 col-sm-3" style="padding-bottom: 10px; margin-left: 15px; word-wrap: break-word;">
<strong>@lang('admin/asset_maintenances/table.asset_name'): </strong>
<a href="{{ route('view/hardware', $assetMaintenance->asset_id) }}">
{{{ $assetMaintenance->asset->name }}}
</a>
</div>
<div class="col-md-3 col-sm-3" style="padding-bottom: 10px; margin-left: 15px; word-wrap: break-word;">
<strong>@lang('admin/asset_maintenances/table.supplier_name'): </strong>
<a href="{{ route('view/supplier', $assetMaintenance->supplier_id) }}">
{{{ $assetMaintenance->supplier->name }}}
</a>
</div>
</div>
<!-- 2nd Row End -->
<!-- 3rd Row Begin -->
<div class="row">
<div class="col-md-3 col-sm-3" style="padding-bottom: 10px; margin-left: 15px; word-wrap: break-word;">
<strong>@lang('admin/asset_maintenances/form.start_date'): </strong>
<?php $startDate = Carbon::parse($assetMaintenance->start_date); ?>
{{{ $startDate->toDateString() }}}
</div>
<div class="col-md-3 col-sm-3" style="padding-bottom: 10px; margin-left: 15px; word-wrap: break-word;">
<strong>@lang('admin/asset_maintenances/form.completion_date'): </strong>
<?php if (is_null($assetMaintenance->completion_date)) {
$calculationEndDate = Carbon::now();
$completionDate = NULL;
} else {
$completionDate = Carbon::parse($assetMaintenance->completion_date);
$calculationEndDate = $completionDate;
}
?>
{{{ $completionDate ? $completionDate->toDateString() : Lang::get('admin/asset_maintenances/message.asset_maintenance_incomplete') }}}
</div>
<div class="col-md-3 col-sm-3" style="padding-bottom: 10px; margin-left: 15px; word-wrap: break-word;">
<strong>@lang('admin/asset_maintenances/form.asset_maintenance_time'): </strong>
{{ $calculationEndDate->diffInDays($startDate) }}
</div>
</div>
<!-- 3rd Row End -->
<!-- 4th Row Begin -->
<div class="row">
<div class="col-md-3 col-sm-3" style="padding-bottom: 10px; margin-left: 15px; word-wrap: break-word;">
<strong>@lang('admin/asset_maintenances/form.cost'): </strong>
{{{ sprintf( Lang::get( 'general.currency' ) . '%01.2f', $assetMaintenance->cost) }}}
</div>
<div class="col-md-3 col-sm-3" style="padding-bottom: 10px; margin-left: 15px; word-wrap: break-word;">
<strong>@lang('admin/asset_maintenances/form.is_warranty'): </strong>
{{{ $assetMaintenance->is_warranty ? Lang::get('admin/asset_maintenances/message.warranty') : Lang::get('admin/asset_maintenances/message.not_warranty') }}}
</div>
</div>
<!-- 4th Row End -->
<!-- 5th Row Begin -->
<div class="row">
<div class="col-md-12 col-sm-12" style="padding-bottom: 10px; margin-left: 15px; word-wrap: break-word;">
<strong>@lang('admin/asset_maintenances/form.notes'): </strong>
{{{ $assetMaintenance->notes }}}
</div>
</div>
<!-- 5th Row End -->
</div> <!-- col-md-9 bio end -->
</div> <!-- row profile end -->
</div> <!-- user-profile end -->
@stop

View File

@@ -50,12 +50,12 @@
@if ($asset->model->deleted_at!='')
<div class="alert alert-warning alert-block">
<i class="fa fa-warning"></i>
@lang('admin/hardware/general.model_deleted', array('model_id' => $asset->model->id))
@lang('admin/hardware/general.model_deleted', ['model_id' => $asset->model->id])
</div>
@elseif ($asset->deleted_at!='')
<div class="alert alert-warning alert-block">
<i class="fa fa-warning"></i>
@lang('admin/hardware/general.deleted', array('asset_id' => $asset->id))
@lang('admin/hardware/general.deleted', ['asset_id' => $asset->id])
</div>
@endif
@@ -254,76 +254,174 @@
</table>
</div>
<!-- checked out assets table -->
<table class="table table-hover table-fixed break-word">
<!-- Asset Maintenance -->
<div class="col-md-12">
<div class="row header">
<div class="col-md-12">
<a href="{{ route('create/asset_maintenances', $asset->id) }}" class="btn btn-success pull-right"><i class="fa fa-plus icon-white"></i> New Improvement</a>
<h6>@lang('general.asset_maintenances')</h6>
</div>
</div>
<!-- Asset Maintenance table -->
@if (count($asset->assetmaintenances) > 0)
<table class="table table-hover">
<thead>
<tr>
<th class="col-md-3">@lang('general.date')</th>
<th class="col-md-2"><span class="line"></span>@lang('general.admin')</th>
<th class="col-md-2"><span class="line"></span>@lang('table.actions')</th>
<th class="col-md-2"><span class="line"></span>@lang('general.user')</th>
<th class="col-md-3"><span class="line"></span>@lang('general.notes')</th>
</tr>
<tr>
<th class="col-md-2"><span class="line"></span>@lang('admin/asset_maintenances/table.supplier_name')</th>
<th class="col-md-2"><span class="line"></span>@lang('admin/asset_maintenances/form.asset_maintenance_type')</th>
<th class="col-md-2"><span class="line"></span>@lang('admin/asset_maintenances/form.start_date')</th>
<th class="col-md-2"><span class="line"></span>@lang('admin/asset_maintenances/form.completion_date')</th>
<th class="col-md-2"><span class="line"></span>@lang('admin/asset_maintenances/table.is_warranty')</th>
<th class="col-md-2"><span class="line"></span>@lang('admin/asset_maintenances/form.cost')</th>
<th class="col-md-1"><span class="line"></span>@lang('table.actions')</th>
</tr>
</thead>
<tbody>
@if (count($asset->assetlog) > 0)
@foreach ($asset->assetlog as $log)
<?php $totalCost = 0; ?>
@foreach ($asset->asset_maintenances as $assetMaintenance)
@if (is_null($assetMaintenance->deleted_at))
<tr>
<td>{{{ $log->created_at }}}</td>
<td>
@if (isset($log->user_id))
{{{ $log->adminlog->fullName() }}}
@endif
</td>
<td>{{ $log->action_type }}</td>
<td>
@if ((isset($log->checkedout_to)) && ($log->checkedout_to!=0) && ($log->checkedout_to!=''))
@if ($log->userlog->deleted_at=='')
<a href="{{ route('view/user', $log->checkedout_to) }}">
{{{ $log->userlog->fullName() }}}
</a>
@else
<del>{{{ $log->userlog->fullName() }}}</del>
@endif
@endif
</td>
<td>
@if ($log->note) {{{ $log->note }}}
@endif
<td><a href="{{ route('view/supplier', $assetMaintenance->supplier_id) }}">{{{ $assetMaintenance->supplier->name }}}</a></td>
<td>{{{ $assetMaintenance->improvement_type }}}</td>
<td>{{{ $assetMaintenance->start_date }}}</td>
<td>{{{ $assetMaintenance->completion_date }}}</td>
<td>{{{ $assetMaintenance->is_warranty ? Lang::get('admin/asset_maintenances/message.warranty') : Lang::get('admin/asset_maintenances/message.not_warranty') }}}</td>
<td>{{{ sprintf( Lang::get( 'general.currency' ) . '%01.2f', $assetMaintenance->cost) }}}</td>
<?php $totalCost += $assetMaintenance->cost; ?>
<td><a href="{{ route('update/asset_maintenance', $assetMaintenance->id) }}" class="btn btn-warning"><i class="fa fa-pencil icon-white"></i></a>
</td>
</tr>
@endforeach
@endif
@endforeach
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>{{{sprintf(Lang::get( 'general.currency' ) . '%01.2f', $totalCost)}}}</td>
</tr>
</tfoot>
</table>
@else
<div class="col-md-12">
<div class="alert alert-info alert-block">
<i class="fa fa-info-circle"></i>
@lang('general.no_results')
</div>
</div>
@endif
</div>
<div class="col-md-12">
<h6>@lang('general.file_uploads') [ <a href="#" data-toggle="modal" data-target="#uploadFileModal">@lang('button.add')</a> ]</h6>
<table class="table table-hover">
<thead>
<tr>
<th class="col-md-5">@lang('general.notes')</th>
<th class="col-md-5"><span class="line"></span>@lang('general.file_name')</th>
<th class="col-md-2"></th>
<th class="col-md-2"></th>
</tr>
</thead>
<tbody>
@if (count($asset->uploads) > 0)
@foreach ($asset->uploads as $file)
<tr>
<td>{{ $asset->created_at }}</td>
<td>
@if (isset($asset->adminuser->id)) {{{ $asset->adminuser->fullName() }}}
@else
@lang('general.unknown_admin')
@endif
@if ($file->note) {{{ $file->note }}}
@endif
</td>
<td>@lang('general.created_asset')</td>
<td></td>
<td>
<!-- @if ($asset->notes)
{{{ $asset->notes }}}
@endif -->
{{{ $file->filename }}}
</td>
<td>
@if ($file->filename)
<a href="{{ route('show/assetfile', [$asset->id, $file->id]) }}" class="btn btn-default">@lang('general.download')</a>
@endif
</td>
<td>
<a class="btn delete-asset btn-danger btn-sm" href="{{ route('delete/assetfile', [$asset->id, $file->id]) }}"><i class="fa fa-trash icon-white"></i></a>
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="4">
@lang('general.no_results')
</td>
</tr>
</tbody>
</table>
@endif
</div>
</tbody>
</table>
</div>
<div class="col-md-12">
<!-- checked out assets table -->
<table class="table table-hover table-fixed break-word">
<thead>
<tr>
<th class="col-md-3">@lang('general.date')</th>
<th class="col-md-2"><span class="line"></span>@lang('general.admin')</th>
<th class="col-md-2"><span class="line"></span>@lang('table.actions')</th>
<th class="col-md-2"><span class="line"></span>@lang('general.user')</th>
<th class="col-md-3"><span class="line"></span>@lang('general.notes')</th>
</tr>
</thead>
<tbody>
@if (count($asset->assetlog) > 0)
@foreach ($asset->assetlog as $log)
<tr>
<td>{{{ $log->created_at }}}</td>
<td>
@if (isset($log->user_id))
{{{ $log->adminlog->fullName() }}}
@endif
</td>
<td>{{ $log->action_type }}</td>
<td>
@if ((isset($log->checkedout_to)) && ($log->checkedout_to!=0) && ($log->checkedout_to!=''))
@if ($log->userlog->deleted_at=='')
<a href="{{ route('view/user', $log->checkedout_to) }}">
{{{ $log->userlog->fullName() }}}
</a>
@else
<del>{{{ $log->userlog->fullName() }}}</del>
@endif
@endif
</td>
<td>
@if ($log->note) {{{ $log->note }}}
@endif
</td>
</tr>
@endforeach
@endif
<tr>
<td>{{ $asset->created_at }}</td>
<td>
@if (isset($asset->adminuser->id)) {{{ $asset->adminuser->fullName() }}}
@else
@lang('general.unknown_admin')
@endif
</td>
<td>@lang('general.created_asset')</td>
<td></td>
<td>
<!-- @if ($asset->notes)
{{{ $asset->notes }}}
@endif -->
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- side address column -->
<div class="col-md-3 col-xs-12 address pull-right">

View File

@@ -281,10 +281,10 @@
<li><a href="{{ URL::to('hardware') }}">@lang('general.list_all')</a></li>
<li class="divider">&nbsp;</li>
<li><a href="{{ URL::to('hardware/models') }}" {{ (Request::is('hardware/models*') ? ' class="active"' : '') }} >@lang('general.asset_models')</a></li>
<li><a href="{{ URL::to('admin/settings/categories') }}" {{ (Request::is('admin/settings/categories*') ? ' class="active"' : '') }} >@lang('general.categories')</a></li>
<li><a href="{{ URL::to('hardware?status=Deleted') }}" {{ (Request::query('status') == 'Deleted' ? ' class="active"' : '') }} >@lang('general.deleted')</a></li>
<li><a href="{{ URL::to('hardware/models') }}" {{{ (Request::is('hardware/models*') ? ' class="active"' : '') }}} >@lang('general.asset_models')</a></li>
<li><a href="{{ URL::to('admin/settings/categories') }}" {{{ (Request::is('admin/settings/categories*') ? ' class="active"' : '') }}} >@lang('general.categories')</a></li>
<li><a href="{{ URL::to('hardware?status=Deleted') }}" {{{ (Request::query('Deleted') ? ' class="active"' : '') }}} >@lang('general.deleted')</a></li>
<li><a href="{{ URL::to('admin/asset_maintenances') }}" >@lang('general.asset_maintenances') </a></li>
</ul>
</li>
<li{{ (Request::is('admin/accessories*') ? ' class="active"><div class="pointer"><div class="arrow"></div><div class="arrow_border"></div></div>' : '>') }}
@@ -309,6 +309,7 @@
</a>
</li>
<li{{ (Request::is('admin/users*') ? ' class="active"><div class="pointer"><div class="arrow"></div><div class="arrow_border"></div></div>' : '>') }}
<a href="{{ URL::to('admin/users') }}">
<i class="fa fa-users"></i>
@@ -328,10 +329,11 @@
<ul class="submenu{{ (Request::is('reports*') ? ' active' : '') }}">
<li><a href="{{ URL::to('reports/activity') }}" {{ (Request::is('reports/activity') ? ' class="active"' : '') }} >@lang('general.activity_report')</a></li>
<li><a href="{{ URL::to('reports/depreciation') }}" {{ (Request::is('reports/depreciation') ? ' class="active"' : '') }} >@lang('general.depreciation_report')</a></li>
<li><a href="{{ URL::to('reports/licenses') }}" {{ (Request::is('reports/licenses') ? ' class="active"' : '') }} >@lang('general.license_report')</a></li>
<li><a href="{{ URL::to('reports/assets') }}" {{ (Request::is('reports/assets') ? ' class="active"' : '') }} >@lang('general.asset_report')</a></li>
<li><a href="{{ URL::to('reports/custom') }}" {{ (Request::is('reports/custom') ? ' class="active"' : '') }} >@lang('general.custom_report')</a></li>
<li><a href="{{ URL::to('reports/depreciation') }}" {{{ (Request::is('reports/depreciation') ? ' class="active"' : '') }}} >@lang('general.depreciation_report')</a></li>
<li><a href="{{ URL::to('reports/licenses') }}" {{{ (Request::is('reports/licenses') ? ' class="active"' : '') }}} >@lang('general.license_report')</a></li>
<li><a href="{{ URL::to('reports/asset_maintenances') }}" {{{ (Request::is('reports/asset_maintenances') ? ' class="active"' : '') }}} >@lang('general.asset_maintenance_report')</a></li>
<li><a href="{{ URL::to('reports/assets') }}" {{{ (Request::is('reports/assets') ? ' class="active"' : '') }}} >@lang('general.asset_report')</a></li>
<li><a href="{{ URL::to('reports/custom') }}" {{{ (Request::is('reports/custom') ? ' class="active"' : '') }}} >@lang('general.custom_report')</a></li>
</ul>
</li>
@endif

View File

@@ -0,0 +1,78 @@
<?php
use Carbon\Carbon;
?>
@extends('backend/layouts/default')
{{-- Page title --}}
@section('title')
@lang('general.asset_maintenance_report') ::
@parent
@stop
{{-- Page content --}}
@section('content')
<div class="page-header">
<div class="pull-right">
<a href="{{ route('reports/export/asset_maintenances') }}" class="btn btn-flat gray pull-right"><i class="fa fa-download icon-white"></i>
@lang('admin/asset_maintenances/table.dl_csv')</a>
</div>
<h3>@lang('general.asset_maintenance_report')</h3>
</div>
<div class="row">
<div class="table-responsive">
<table id="example">
<thead>
<tr role="row">
<th class="col-sm-1">@lang('admin/asset_maintenances/table.asset_name')</th>
<th class="col-sm-1">@lang('admin/asset_maintenances/table.supplier_name')</th>
<th class="col-sm-1">@lang('admin/asset_maintenances/form.asset_maintenance_type')</th>
<th class="col-sm-1">@lang('admin/asset_maintenances/form.title')</th>
<th class="col-sm-1">@lang('admin/asset_maintenances/form.start_date')</th>
<th class="col-sm-1">@lang('admin/asset_maintenances/form.completion_date')</th>
<th class="col-sm-1">@lang('admin/asset_maintenances/form.asset_maintenance_time')</th>
<th class="col-sm-1">@lang('admin/asset_maintenances/form.cost')</th>
</tr>
</thead>
<tbody>
<?php
$totalDays = 0;
$totalCost = 0;
?>
@foreach ($assetMaintenances as $assetMaintenance)
<tr>
<td>{{{ $assetMaintenance->asset->name }}}</td>
<td>{{{ $assetMaintenance->supplier->name }}}</td>
<td>{{{ $assetMaintenance->asset_maintenance_type }}}</td>
<td>{{{ $assetMaintenance->title }}}</td>
<td>{{{ $assetMaintenance->start_date }}}</td>
<td>{{{ is_null($assetMaintenance->completion_date) ? Lang::get('admin/asset_maintenances/message.asset_maintenance_incomplete') : $assetMaintenance->completion_date }}}</td>
@if (is_null($assetMaintenance->asset_maintenance_time))
<?php
$assetMaintenanceTime = intval(Carbon::now()->diffInDays(Carbon::parse($assetMaintenance->start_date)));
?>
@else
<?php
$assetMaintenanceTime = intval($assetMaintenance->asset_maintenance_time);
?>
@endif
<td>{{{ $assetMaintenanceTime }}}</td>
<td>@lang('general.currency'){{ number_format($assetMaintenance->cost,2) }}</td>
</tr>
<?php
$totalDays += $assetMaintenanceTime;
$totalCost += floatval($assetMaintenance->cost);
?>
@endforeach
</tbody>
<tfoot>
<tr>
<td colspan="6" align="right"><strong>Totals:</strong></td>
<td>{{number_format($totalDays)}}</td>
<td>@lang('general.currency'){{ number_format($totalCost,2) }}</td>
</tr>
</tfoot>
</table>
</div>
</div>
@stop

View File

@@ -25,86 +25,144 @@
<div class="col-md-9 bio">
<div class="profile-box">
<!-- checked out suppliers table -->
<h6>Assets</h6>
<br>
@if (count($supplier->assets) > 0)
<table id="example">
<thead>
<tr role="row">
<th class="col-md-3">Name</th>
<th class="col-md-3">Asset Tag</th>
<th class="col-md-3">User</th>
<th class="col-md-2">Actions</th>
</tr>
</thead>
<tbody>
<!-- checked out suppliers table -->
<h6>Assets</h6>
<br>
@if (count($supplier->assets) > 0)
<table id="example">
<thead>
<tr role="row">
<th class="col-md-3">Name</th>
<th class="col-md-3">Asset Tag</th>
<th class="col-md-3">User</th>
<th class="col-md-2">Actions</th>
</tr>
</thead>
<tbody>
@foreach ($supplier->assets as $supplierassets)
<tr>
<td><a href="{{ route('view/hardware', $supplierassets->id) }}">{{{ $supplierassets->name }}}</a></td>
<td><a href="{{ route('view/hardware', $supplierassets->id) }}">{{{ $supplierassets->asset_tag }}}</a></td>
<td>
@if ($supplierassets->assigneduser)
<a href="{{ route('view/user', $supplierassets->assigned_to) }}">
{{{ $supplierassets->assigneduser->fullName() }}}
</a>
@endif
</td>
<td>
@if ($supplierassets->assigned_to != '')
<a href="{{ route('checkin/hardware', $supplierassets->id) }}" class="btn-flat info">Checkin</a>
@else
<a href="{{ route('checkout/hardware', $supplierassets->id) }}" class="btn-flat success">Checkout</a>
@endif
</td>
@foreach ($supplier->assets as $supplierassets)
<tr>
<td><a href="{{ route('view/hardware', $supplierassets->id) }}">{{{ $supplierassets->name }}}</a></td>
<td><a href="{{ route('view/hardware', $supplierassets->id) }}">{{{ $supplierassets->name }}}</a></td>
<td><a href="{{ route('view/hardware', $supplierassets->id) }}">{{{ $supplierassets->asset_tag }}}</a></td>
<td>
@if ($supplierassets->assigneduser)
<a href="{{ route('view/user', $supplierassets->assigned_to) }}">
{{{ $supplierassets->assigneduser->fullName() }}}
</a>
@endif
</td>
<td>
@if ($supplierassets->assigned_to != '')
<a href="{{ route('checkin/hardware', $supplierassets->id) }}" class="btn-flat info">Checkin</a>
@else
<a href="{{ route('checkout/hardware', $supplierassets->id) }}" class="btn-flat success">Checkout</a>
@endif
</td>
</tr>
@endforeach
</tr>
@endforeach
</tbody>
</table>
</tbody>
</table>
@else
<div class="col-md-12">
<div class="alert alert-info alert-block">
<i class="fa fa-info-circle"></i>
@lang('general.no_results')
</div>
</div>
@endif
<br>
<br>
<h6>Software</h6>
<br>
@if (count($supplier->licenses) > 0)
<table class="table table-hover">
<thead>
<tr>
<th class="col-md-4"><span class="line"></span>Name</th>
<th class="col-md-4"><span class="line"></span>Serial</th>
</tr>
</thead>
<tbody>
@foreach ($supplier->licenses as $license)
<tr>
<td><a href="{{ route('view/license', $license->id) }}">{{{ $license->name }}}</a></td>
<td><a href="{{ route('view/license', $license->id) }}">{{{ $license->serial }}}</a></td>
</td>
</tr>
@endforeach
</tbody>
</table>
@else
@else
<div class="col-md-12">
<div class="alert alert-info alert-block">
<i class="fa fa-info-circle"></i>
@lang('general.no_results')
</div>
</div>
@endif
<br>
<br>
<h6>Software</h6>
<br>
@if (count($supplier->licenses) > 0)
<table class="table table-hover">
<thead>
<tr>
<th class="col-md-4"><span class="line"></span>Name</th>
<th class="col-md-4"><span class="line"></span>Serial</th>
</tr>
</thead>
<tbody>
@foreach ($supplier->licenses as $license)
<tr>
<td><a href="{{ route('view/license', $license->id) }}">{{{ $license->name }}}</a></td>
<td><a href="{{ route('view/license', $license->id) }}">{{{ $license->serial }}}</a></td>
</td>
</tr>
@endforeach
</tbody>
</table>
@else
<div class="col-md-12">
<div class="alert alert-info alert-block">
<i class="fa fa-info-circle"></i>
@lang('general.no_results')
</div>
</div>
@endif
<!-- Improvements -->
<br>
<br>
<h6>Improvements</h6>
<br>
<!-- Improvement table -->
@if (count($supplier->improvements) > 0)
<table class="table table-hover">
<thead>
<tr>
<th class="col-md-2"><span class="line"></span>@lang('admin/improvements/table.asset_name')</th>
<th class="col-md-2"><span class="line"></span>@lang('admin/improvements/form.improvement_type')</th>
<th class="col-md-2"><span class="line"></span>@lang('admin/improvements/form.start_date')</th>
<th class="col-md-2"><span class="line"></span>@lang('admin/improvements/form.completion_date')</th>
<th class="col-md-2"><span class="line"></span>@lang('admin/improvements/table.is_warranty')</th>
<th class="col-md-2"><span class="line"></span>@lang('admin/improvements/form.cost')</th>
<th class="col-md-1"><span class="line"></span>@lang('table.actions')</th>
</tr>
</thead>
<tbody>
<?php $totalCost = 0; ?>
@foreach ($supplier->improvements as $improvement)
@if (is_null($improvement->deleted_at))
<tr>
<td><a href="{{ route('view/hardware', $improvement->asset_id) }}">{{{ $improvement->asset->name }}}</a></td>
<td>{{{ $improvement->improvement_type }}}</td>
<td>{{{ $improvement->start_date }}}</td>
<td>{{{ $improvement->completion_date }}}</td>
<td>{{{ $improvement->is_warranty ? Lang::get('admin/improvements/message.warranty') : Lang::get('admin/improvements/message.not_warranty') }}}</td>
<td>{{{ sprintf( Lang::get( 'general.currency' ) . '%01.2f', $improvement->cost) }}}</td>
<?php $totalCost += $improvement->cost; ?>
<td><a href="{{ route('update/improvement', $improvement->id) }}" class="btn btn-warning"><i class="fa fa-pencil icon-white"></i></a>
</td>
</tr>
@endif
@endforeach
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>{{{sprintf(Lang::get( 'general.currency' ) . '%01.2f', $totalCost)}}}</td>
</tr>
</tfoot>
</table>
@else
<div class="col-md-12">
<div class="alert alert-info alert-block">
<i class="fa fa-info-circle"></i>
@lang('general.no_results')
</div>
</div>
@endif
<div class="col-md-12">
<div class="alert alert-info alert-block">
<i class="fa fa-info-circle"></i>
@lang('general.no_results')
</div>
</div>
@endif
</div>
</div>

View File

@@ -26,8 +26,8 @@ $app = new Illuminate\Foundation\Application;
$env = $app->detectEnvironment(array(
'local' => array('YourLocalDevHostname','AlisonMBP'),
'staging' => array('staging.yourserver.com'),
'local' => array('homestead','AlisonMBP'),
'staging' => array('stagingweb01'),
'production' => array('www.yourserver.com')
));