public static function isWorkorderAlreadyUploaded($workorderBlob) { try { if ($workorderBlob != null) { if (!Workorder::isWorkorderAlreadyUploaded($workorderBlob)) { echo AppUtil::getReturnStatus("Successful", "Workorder not Already Uploaded"); } else { echo AppUtil::getReturnStatus("Unsuccessful", "Workorder Already Uploaded"); } } else { echo AppUtil::getReturnStatus("Unsuccessful", "Invalid Parameters"); } } catch (Exception $e) { echo AppUtil::getReturnStatus("Unsuccessful", $e->getMessage()); } }
$home->show(); break; case 'workunits': $workunits = new Workunits(); $workunits->show(); break; case 'workunit': $workunit = new Workunit(); $workunit->show(); break; case 'workorders': $workorders = new Workorders(); $workorders->show(); break; case 'workorder': $workorder = new Workorder(); $workorder->show(); break; case 'incidents': $incidents = new Incidents(); $incidents->show(); break; case 'incident': $incident = new Incident(); $incident->show(); break; case 'calendars': $calendars = new Calendars(); $calendars->show(); break; default:
public function postDetach() { if (Input::has('id') && Input::has('section_id')) { $section_id = Input::get('section_id'); $id = Input::get('id'); Workorder::find($id)->sections()->detach(Section::find($section_id)); return ['status' => true]; } else { return ['status' => false]; } }
public function get_wolist($status_id = false) { if (!$status_id) { $status_id = 1; } $allowed = array('taxi_number', 'mechanic', 'complaint', 'information_complaint', 'inserted_date_set'); // add allowable columns to search on $sort = in_array(Input::get('sort'), $allowed) ? Input::get('sort') : 'taxi_number'; // if user type in the url a column that doesnt exist app will default to id $order = Input::get('order') === 'desc' ? 'desc' : 'asc'; // default desc $keyword = Input::get('q'); $search = Input::get('search'); $wo = Workorder::join('fleets as f', 'f.id', '=', 'work_orders.fleet_id')->where('work_orders.pool_id', '=', Auth::user()->pool_id)->where('work_orders.status', '=', $status_id)->order_by($sort, $order); $q = null; if (Input::has('q')) { $wo = $wo->where($search, 'like', '%' . $keyword . '%'); $q = '&search=' . $search . '&q=' . $keyword; } $wo = $wo->paginate(20, array('work_orders.id', 'km', 'inserted_date_set', 'complaint', 'information_complaint', 'mechanic', 'work_orders.pool_id', 'taxi_number', 'police_number')); $this->data['querystr'] = '&order=' . (Input::get('order') == 'asc' || null ? 'desc' : 'asc') . $q; $this->data['wos'] = $wo; $this->data['searchby'] = $search; $this->data['q'] = $keyword; $this->data['status_id'] = $status_id; $this->data['pagination'] = $wo->appends(array('search' => Input::get('search'), 'q' => Input::get('q'), 'sort' => Input::get('sort'), 'order' => Input::get('order')))->links(); //$this->data['wos'] = Workorder::where_status($status_id)->where_pool_id(Auth::user()->pool_id)->order_by('inserted_date_set','desc')->get(); return View::make('themes.modul.' . $this->views . '.wolist', $this->data); }
public function show() { if ($this->permission) { $system = System::getInstance(); $message = ""; switch ($this->operation) { case 'delete': $workorder = new Workorder(); $result = $workorder->deleteWorkOrder($this->id_workorder); unset($workorder); if ($result) { $this->id_workorder = -1; $message = "<h2 class='suc'>" . __('Successfully deleted') . "</h2>"; } else { $message = "<h2 class='error'>" . __('An error ocurred while deleting the workorder') . "</h2>"; } break; } $this->showWorkOrders($message); } else { $this->showNoPermission(); } }
public function get_cetakwo($woid = false) { if (!$woid) { return false; } $this->data['wo'] = Workorder::find($woid); return View::make('themes.modul.' . $this->report . '.wo', $this->data); }
function tenderApproval() { $response = new Response(); try { $projectId = $this->input->post("tender-project-id"); $contractorId = $this->input->post("contractor-id"); $percentage = $this->input->post("tender-percent"); $project = $this->findById("Project", $projectId); if ($project == null) { throw new RuntimeException("Invalid Project..!"); } $project->setStatus(Project::PROJECT_WORK_ORDER); $tenderApproval = new TenderApproval(); $tenderApproval->setProject($project); $tenderApproval->setApprovedBy($this->getLoggedInUser()); $tenderApproval->setCreated(new DateTime()); $workOrder = new Workorder(); $workOrder->setProject($project); $workOrder->setCreated(new DateTime()); $this->save($workOrder); $contractor = $this->findById("Contractor", $contractorId); if ($contractor == null) { throw new RuntimeException("Ïnvalid Contractor !"); } $tenderApproval->setContractor($contractor); $tenderApproval->setPercentage($percentage); $this->save($tenderApproval); } catch (Exception $e) { $response->setStatus(false); $response->setErrorMessage($e->getMessage()); } $this->output->set_content_type('application/json')->set_output(json_encode($response)); }
Route::post('workorders/detach/{workorderId}', 'WorkordersController@detach'); Route::post('workorders/store', 'ResponsesController@store'); Route::get('workorders/{workorderId}/report', 'WorkordersController@getReport'); Route::post('workorders/{workorderId}/report', 'WorkordersController@postReport'); /* API routes */ Route::group(['prefix' => 'api'], function () { Route::get('workorders/{id}', function ($id) { $user = User::findOrFail($id); return $user->workorders()->with('property')->where('status', 'accepted')->get(); }); Route::get('workorders/assigned/{id}', function ($id) { $user = User::findOrFail($id); return $user->workorders()->with('property')->where('status', 'assigned')->get(); }); Route::get('workorder/{id}', function ($id) { return Workorder::with('sections.tasks')->find($id); }); Route::get('tasks/{id}', function ($id) { return Task::where('section_id', $id)->get(); }); Route::post('auth/mobile', 'UsersController@postAuthMobile'); Route::get('responses/{workorder_id}/{section_id}', 'ResponsesController@getApiResponses'); }); /* * Resourcefull Routes * */ Route::resource('properties', 'PropertiesController'); Route::resource('users', 'UsersController'); Route::resource('workers', 'WorkersController'); Route::resource('tasks', 'TasksController');
public function getReport($workorderId) { return Workorder::with('report')->findOrFail($workorderId); }