Browse Source

update field for ospro general

pull/3/head
farhan048 1 year ago
parent
commit
b5e3bf60fd
  1. 85
      app/Http/Controllers/CompanyController.php
  2. 25
      app/Http/Controllers/Controller.php
  3. 37
      app/Models/Company.php
  4. 6
      app/Models/Divisi.php
  5. 2
      app/Models/Menu.php
  6. 2
      app/Models/ProjectPhase.php
  7. 2
      app/Models/ProjectRole.php
  8. 2
      app/Models/ProjectType.php
  9. 2
      app/Models/Role.php
  10. 2
      app/Models/RoleMenu.php
  11. 2
      app/Models/Satuan.php

85
app/Http/Controllers/CompanyController.php

@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
use App\Models\Company;
use Illuminate\Http\Request;
class CompanyController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param \App\Company $company
* @return \Illuminate\Http\Response
*/
public function show(Company $company)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Company $company
* @return \Illuminate\Http\Response
*/
public function edit(Company $company)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Company $company
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Company $company)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Company $company
* @return \Illuminate\Http\Response
*/
public function destroy(Company $company)
{
//
}
}

25
app/Http/Controllers/Controller.php

@ -1,6 +1,7 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use App\Models\UserToActivity;
@ -16,18 +17,21 @@ class Controller extends BaseController
protected $pathDocument = "assets/file/project/";
protected $pathTmpImport = "assets/file/tmpimport/";
protected $pathActivityDocument = "assets/file/activity/";
protected $listJoinAll = ['first', 'second', 'third', 'fourth', 'fifth',
'sixth', 'seventh', 'eighth', 'ninth', 'tenth'];
protected $listJoinAll = [
'first', 'second', 'third', 'fourth', 'fifth',
'sixth', 'seventh', 'eighth', 'ninth', 'tenth'
];
protected $currentDate;
protected $currentName;
protected $currentId;
protected $companyId;
public function __construct()
{
$this->currentDate = date("Y-m-d H:i:s");
$this->currentName = auth()->user() ? auth()->user()->name : "system";
$this->currentId = auth()->user() ? auth()->user()->id : 0;
$this->companyId = auth()->user() ? auth()->user()->company_id : 0;
$this->pathImage = config('assets.image');
$this->pathDocument = config('assets.project');
$this->pathActivityDocument = config('assets.activity');
@ -182,7 +186,8 @@ class Controller extends BaseController
return $query;
}
private function whereConditionSingleTable($oldQuery, $operator, $column, $value, $value2){
private function whereConditionSingleTable($oldQuery, $operator, $column, $value, $value2)
{
$query = $oldQuery;
if ($operator == "range") {
$query = $query->whereBetween($column, [$value, $value2]);
@ -223,7 +228,8 @@ class Controller extends BaseController
return $query;
}
protected function calculateAllCost($activity_id, $proyek_id){
protected function calculateAllCost($activity_id, $proyek_id)
{
$humanCostPlanning = $this->calculateAllHumanCost($activity_id, $proyek_id);
$materialCostPlanning = $this->calculateMaterialCost($activity_id, $proyek_id);
$toolsCostPlanning = 0;
@ -271,7 +277,8 @@ class Controller extends BaseController
return $totalCost;
}
protected function getLoc($lat, $lng){
protected function getLoc($lat, $lng)
{
// $response = Http::get(config('api.nominatim') . "/reverse?lat=".$lat."&lon=".$lng."&format=json");
// return $response->json;
@ -281,7 +288,8 @@ class Controller extends BaseController
return $response;
}
private function curlRequest($url){
private function curlRequest($url)
{
$ch = curl_init();
// $headers = [
// 'Authorization: '.$token
@ -298,7 +306,8 @@ class Controller extends BaseController
return json_decode($response);
}
protected function addDetailK3($dataDetail, $report_id){
protected function addDetailK3($dataDetail, $report_id)
{
foreach ($dataDetail as $value) {
$dataNew = array(
"report_k3_id" => $report_id,

37
app/Models/Company.php

@ -0,0 +1,37 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Company extends Model
{
protected $table = 'm_divisi';
const CREATED_AT = 'created_at';
const UPDATED_AT = 'updated_at';
protected $fillable = [
"registration_no",
"company_name",
"address",
"phone_no",
"email",
"description",
"logo_login",
"logo_header",
"favicon_image",
"login_instruction",
"about",
"html_title",
"app_name",
"base_url",
"is_active",
"template_id",
'created_at',
'created_by',
'updated_at',
'updated_by',
'company_id'
];
}

6
app/Models/Divisi.php

@ -19,10 +19,12 @@ class Divisi extends Model
'created_at',
'created_by',
'updated_at',
'updated_by'
'updated_by',
'company_id'
];
public static function boot() {
public static function boot()
{
parent::boot();
static::deleting(function ($data) {

2
app/Models/Menu.php

@ -13,6 +13,6 @@ class Menu extends Model
protected $fillable = [
'parent_id', 'icon', 'name', 'alias_name', 'url', 'sequence',
'created_at', 'created_by', 'updated_at', 'updated_by'
'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id'
];
}

2
app/Models/ProjectPhase.php

@ -12,6 +12,6 @@ class ProjectPhase extends Model
const UPDATED_AT = 'updated_at';
protected $fillable = [
'name', 'color', 'order', 'created_at', 'created_by', 'updated_at', 'updated_by'
'name', 'color', 'order', 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id'
];
}

2
app/Models/ProjectRole.php

@ -12,6 +12,6 @@ class ProjectRole extends Model
const UPDATED_AT = 'updated_at';
protected $fillable = [
'name', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by'
'name', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id'
];
}

2
app/Models/ProjectType.php

@ -12,6 +12,6 @@ class ProjectType extends Model
const UPDATED_AT = 'updated_at';
protected $fillable = [
'name', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by'
'name', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id'
];
}

2
app/Models/Role.php

@ -12,6 +12,6 @@ class Role extends Model
const UPDATED_AT = 'updated_at';
protected $fillable = [
'name', 'description', 'default_page', 'created_at', 'created_by', 'updated_at', 'updated_by'
'name', 'description', 'default_page', 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id'
];
}

2
app/Models/RoleMenu.php

@ -12,6 +12,6 @@ class RoleMenu extends Model
const UPDATED_AT = 'updated_at';
protected $fillable = [
'role_id', 'menu_id', 'created_at', 'created_by', 'updated_at', 'updated_by'
'role_id', 'menu_id', 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id', "create", "read", "update", "delete"
];
}

2
app/Models/Satuan.php

@ -12,6 +12,6 @@ class Satuan extends Model
const UPDATED_AT = 'updated_at';
protected $fillable = [
'name', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by'
'name', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id'
];
}

Loading…
Cancel
Save