addition of template for creation of valves, and creation of models for data administration between tables, based on the creation of the project
This commit is contained in:
parent
44e0a3f373
commit
0238996df9
88
app/Http/Controllers/CreateProjectController.php
Normal file
88
app/Http/Controllers/CreateProjectController.php
Normal file
|
|
@ -0,0 +1,88 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
use App\Models\company_project;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
use App\Models\installation;
|
||||||
|
|
||||||
|
class CreateProjectController extends Controller
|
||||||
|
{
|
||||||
|
public function listCompanies(){
|
||||||
|
$companies = User::where('user_type',3)->get();
|
||||||
|
return view ('projectsClients/createProject', ['companies' => $companies]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function createProject(Request $request){
|
||||||
|
// dd($request);
|
||||||
|
|
||||||
|
// Validação...
|
||||||
|
$installationId = $request->input('installation_id');
|
||||||
|
|
||||||
|
if ($installationId == 'new_install') {
|
||||||
|
// Criar uma nova instalação...
|
||||||
|
$newInstallation = new Installation;
|
||||||
|
$newInstallation->installation_name = $request->input('new_company_name');
|
||||||
|
$newInstallation->address = $request->input('new_company_address');
|
||||||
|
$newInstallation->user_id = $request->input('user_id');
|
||||||
|
|
||||||
|
$newInstallation->save();
|
||||||
|
|
||||||
|
// Use o id da nova instalação.
|
||||||
|
$installationId = $newInstallation->id;
|
||||||
|
// dd($installationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
$project = new company_project;
|
||||||
|
|
||||||
|
$project->description_project = $request->input('description_project');
|
||||||
|
$project->n_project_ispt = $request->input('n_project_ispt');
|
||||||
|
$project->responsible_project_ispt = $request->input('responsible_project_ispt');
|
||||||
|
$project->responsible_project_company = $request->input('responsible_project_company');
|
||||||
|
$project->date_started = $request->input('date_started');
|
||||||
|
|
||||||
|
$project->installation_ID = $installationId;
|
||||||
|
|
||||||
|
$project->save();
|
||||||
|
|
||||||
|
return redirect()->route('testExcel')->with('success', 'Dados guardados com sucesso');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function storeProject(Request $request)
|
||||||
|
{
|
||||||
|
if ($request->input('company_id') == 'new') {
|
||||||
|
$company = new company_project; // Substitua "Company" pelo nome do seu modelo de empresas
|
||||||
|
$company->name = $request->input('new_company_name');
|
||||||
|
$company->save();
|
||||||
|
|
||||||
|
$company_id = $company->id;
|
||||||
|
} else {
|
||||||
|
$company_id = $request->input('company_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Agora, você pode usar $company_id ao criar o projeto
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getByUserNif (Request $request){
|
||||||
|
|
||||||
|
// dd(Installation::where('user_id', $request->input('user_id'))->get());
|
||||||
|
|
||||||
|
$user_id = $request->input('user_id'); //Check
|
||||||
|
$installations = Installation::where('user_id', $user_id)->get();
|
||||||
|
|
||||||
|
return response()->json($installations);
|
||||||
|
}
|
||||||
|
public function createEquipamentProject (Request $request){
|
||||||
|
|
||||||
|
dd($request->input('data'));
|
||||||
|
// $data = $request->input('data');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
17
app/Http/Controllers/EquipamentsController.php
Normal file
17
app/Http/Controllers/EquipamentsController.php
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use APP\Models\equipament_Type;
|
||||||
|
use App\Models\factorie;
|
||||||
|
use App\Models\specific_Attributes_Equipament_Type;
|
||||||
|
use App\Models\installation;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class EquipamentsCOntroller extends Controller
|
||||||
|
{
|
||||||
|
public function CreateEquipaments (){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
use App\Models\pending_user;
|
use App\Models\pending_user;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Models\TypeUser;
|
||||||
|
|
||||||
class Pending_UserController extends Controller
|
class Pending_UserController extends Controller
|
||||||
{
|
{
|
||||||
|
|
@ -22,12 +23,12 @@ public function ListPendingUsers()
|
||||||
|
|
||||||
public function ShowFormUser($id){
|
public function ShowFormUser($id){
|
||||||
$pend_users = pending_user::findOrFail($id);
|
$pend_users = pending_user::findOrFail($id);
|
||||||
return view ('Admin.CrudUsers.createUser', compact('pend_users'));
|
$types = TypeUser::all();
|
||||||
|
return view ('Admin.CrudUsers.createUser', compact('pend_users','types'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request){
|
||||||
{
|
|
||||||
|
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,6 @@ class VerifyCsrfToken extends Middleware
|
||||||
* @var array<int, string>
|
* @var array<int, string>
|
||||||
*/
|
*/
|
||||||
protected $except = [
|
protected $except = [
|
||||||
//
|
'/create-equipament-project',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
app/Models/ambits_equipment.php
Normal file
14
app/Models/ambits_equipment.php
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ambits_equipment extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
}
|
||||||
13
app/Models/company_project.php
Normal file
13
app/Models/company_project.php
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class company_project extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
public $timestamps = false;
|
||||||
|
}
|
||||||
16
app/Models/equipament.php
Normal file
16
app/Models/equipament.php
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use APP\Models\equipament_Type;
|
||||||
|
use App\Models\factorie;
|
||||||
|
use App\Models\specific_Attributes_Equipament_Type;
|
||||||
|
use App\Models\installation;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class equipament extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
}
|
||||||
11
app/Models/equipament_Type.php
Normal file
11
app/Models/equipament_Type.php
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class equipament_Type extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
}
|
||||||
11
app/Models/factorie.php
Normal file
11
app/Models/factorie.php
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class factorie extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
}
|
||||||
13
app/Models/installation.php
Normal file
13
app/Models/installation.php
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class installation extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
public $timestamps = false;
|
||||||
|
}
|
||||||
11
app/Models/specific_Attributes_Equipament_Type.php
Normal file
11
app/Models/specific_Attributes_Equipament_Type.php
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class specific_Attributes_Equipament_Type extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
}
|
||||||
|
|
@ -41,6 +41,115 @@ :root {
|
||||||
--font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
--font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Progress Bar */
|
||||||
|
|
||||||
|
#progressbar {
|
||||||
|
/* margin-bottom: 30px; */
|
||||||
|
overflow: hidden;
|
||||||
|
/*CSS counters to number the steps*/
|
||||||
|
counter-reset: step;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Botao para o "Next" */
|
||||||
|
#progressbar li {
|
||||||
|
list-style-type: none;
|
||||||
|
color: black;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-size: 15px;
|
||||||
|
width: 33.33%;
|
||||||
|
float: left;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
#progressbar li:before {
|
||||||
|
content: counter(step);
|
||||||
|
counter-increment: step;
|
||||||
|
width: 52px;
|
||||||
|
line-height: 45px;
|
||||||
|
display: block;
|
||||||
|
font-size: 17px;
|
||||||
|
color: #333;
|
||||||
|
background: rgb(196, 196, 196);
|
||||||
|
border-radius: 3px;
|
||||||
|
margin: 0 auto 5px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*progressbar connectors*/
|
||||||
|
#progressbar li:after {
|
||||||
|
content: '';
|
||||||
|
width: 90%;
|
||||||
|
/* height: 2px; */
|
||||||
|
height: 9px;
|
||||||
|
background: none;
|
||||||
|
position: absolute;
|
||||||
|
left: -45%;
|
||||||
|
/* top: 9px; */
|
||||||
|
top: 17px;
|
||||||
|
/* z-index: -1; */
|
||||||
|
/*put it behind the numbers*/
|
||||||
|
}
|
||||||
|
|
||||||
|
#progressbar li:first-child:after {
|
||||||
|
/*connector not needed before the first step*/
|
||||||
|
content: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*marking active/completed steps green*/
|
||||||
|
/*The number of the step and the connector before it = green*/
|
||||||
|
#progressbar li.active:before,
|
||||||
|
#progressbar li.active:after {
|
||||||
|
background: #007bff;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#msform {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#msform fieldset {
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 80%;
|
||||||
|
margin: 0 10%;
|
||||||
|
/*stacking fieldsets above each other*/
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Inicialmente oculta os outros Fieldsets tirando o primeiro. */
|
||||||
|
#msform fieldset:not(:first-of-type) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*inputs*/
|
||||||
|
/* #msform input, */
|
||||||
|
#msform textarea {
|
||||||
|
padding: 15px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 3px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-family: montserrat;
|
||||||
|
color: #2C3E50;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*buttons*/
|
||||||
|
#msform .action-button {
|
||||||
|
width: 100px;
|
||||||
|
background: #007bff;
|
||||||
|
font-weight: bold;
|
||||||
|
color: white;
|
||||||
|
border: 0 none;
|
||||||
|
border-radius: 3px;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 10px;
|
||||||
|
margin: 10px 5px;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
*,
|
*,
|
||||||
*::before,
|
*::before,
|
||||||
*::after {
|
*::after {
|
||||||
|
|
|
||||||
Binary file not shown.
BIN
public/templateExcel/FinalTemplate1.xlsx
Normal file
BIN
public/templateExcel/FinalTemplate1.xlsx
Normal file
Binary file not shown.
|
|
@ -31,7 +31,7 @@
|
||||||
<input type="text" class="form-control" id="user_nif" name="user_nif" value="{{$pend_users->pending_nif}}" readonly>
|
<input type="text" class="form-control" id="user_nif" name="user_nif" value="{{$pend_users->pending_nif}}" readonly>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
{{-- <div class="form-group">
|
||||||
<label for="user_type">Tipo de usuário:</label>
|
<label for="user_type">Tipo de usuário:</label>
|
||||||
<select class="form-control" name="user_type" id="user_type">
|
<select class="form-control" name="user_type" id="user_type">
|
||||||
<option value="Cliente" selected>Cliente</option>
|
<option value="Cliente" selected>Cliente</option>
|
||||||
|
|
@ -41,6 +41,14 @@
|
||||||
<option value="Tecnicos">Tecnicos</option>
|
<option value="Tecnicos">Tecnicos</option>
|
||||||
<option value="inspetor">inspetor</option>
|
<option value="inspetor">inspetor</option>
|
||||||
</select>
|
</select>
|
||||||
|
</div> --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="user_type">Tipo de usuário:</label>
|
||||||
|
<select class="form-control" name="user_type" id="user_type">
|
||||||
|
@foreach($types as $type)
|
||||||
|
<option value="{{ $type->id }}">{{ $type->type }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
|
|
||||||
<title>ISPT 4.0</title>
|
<title>ISPT 4.0</title>
|
||||||
|
|
||||||
<!-- Google Font: Source Sans Pro -->
|
<!-- Google Font: Source Sans Pro -->
|
||||||
|
|
@ -33,6 +36,9 @@
|
||||||
<!-- jQuery UI -->
|
<!-- jQuery UI -->
|
||||||
<link rel="stylesheet" href="{{ asset('plugins/jquery-ui/jquery-ui.css') }}">
|
<link rel="stylesheet" href="{{ asset('plugins/jquery-ui/jquery-ui.css') }}">
|
||||||
|
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||||
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="hold-transition sidebar-mini layout-fixed">
|
<body class="hold-transition sidebar-mini layout-fixed">
|
||||||
|
|
@ -121,7 +127,7 @@ class="fas fa-bars"></i></a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="#" class="nav-link">
|
<a href="{{ route('createProject')}}" class="nav-link">
|
||||||
<i class="nav-icon fas fa-helmet-safety"></i>
|
<i class="nav-icon fas fa-helmet-safety"></i>
|
||||||
<p> Criar obra </p>
|
<p> Criar obra </p>
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -144,7 +150,7 @@ class="fas fa-bars"></i></a>
|
||||||
<!-- /.Multiple menu item -->
|
<!-- /.Multiple menu item -->
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="relatorios.html" class="nav-link">
|
<a href="{{ route('testExcel')}}" class="nav-link">
|
||||||
<i class="nav-icon fas fa-file"></i>
|
<i class="nav-icon fas fa-file"></i>
|
||||||
<p>
|
<p>
|
||||||
Relatórios
|
Relatórios
|
||||||
|
|
@ -250,13 +256,6 @@ class="fas fa-bars"></i></a>
|
||||||
|
|
||||||
<!-- jQuery -->
|
<!-- jQuery -->
|
||||||
<script src="{{ asset('plugins/jquery/jquery.min.js') }}"></script>
|
<script src="{{ asset('plugins/jquery/jquery.min.js') }}"></script>
|
||||||
<!-- jQuery UI 1.11.4 -->
|
|
||||||
<script src="{{ asset('plugins/jquery-ui/jquery-ui.min.js') }}"></script>
|
|
||||||
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
|
|
||||||
<script>
|
|
||||||
$.widget.bridge('uibutton', $.ui.button)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Bootstrap 4 -->
|
<!-- Bootstrap 4 -->
|
||||||
|
|
@ -277,6 +276,11 @@ class="fas fa-bars"></i></a>
|
||||||
<!-- jQuery Knob Chart -->
|
<!-- jQuery Knob Chart -->
|
||||||
<script src="{{ asset('plugins/jquery-knob/jquery.knob.min.js') }}"></script>
|
<script src="{{ asset('plugins/jquery-knob/jquery.knob.min.js') }}"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- daterangepicker -->
|
<!-- daterangepicker -->
|
||||||
<script src="plugins/moment/moment.min.js"></script>
|
<script src="plugins/moment/moment.min.js"></script>
|
||||||
<script src="{{ asset('plugins/daterangepicker/daterangepicker.js') }}"></script>
|
<script src="{{ asset('plugins/daterangepicker/daterangepicker.js') }}"></script>
|
||||||
|
|
@ -289,10 +293,23 @@ class="fas fa-bars"></i></a>
|
||||||
|
|
||||||
<!-- AdminLTE App -->
|
<!-- AdminLTE App -->
|
||||||
<script src="{{ asset('js/adminlte.js') }}"></script>
|
<script src="{{ asset('js/adminlte.js') }}"></script>
|
||||||
<!-- AdminLTE for demo purposes -->
|
|
||||||
<!--<script src="dist/js/demo.js"></script> -->
|
<!-- jQuery UI 1.11.4 -->
|
||||||
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
|
<script src="{{ asset('plugins/jquery-ui/jquery-ui.min.js') }}"></script>
|
||||||
<script src="{{ asset('js/pages/dashboard.js') }}"></script>
|
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$.widget.bridge('uibutton', $.ui.button)
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
{{-- Script que dao erro no projecto --}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- AdminLTE for demo purposes -->
|
||||||
|
<!--<script src="dist/js/demo.js"></script> -->
|
||||||
|
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
|
||||||
|
{{-- <script src="{{ asset('js/pages/dashboard.js') }}"></script> --}}
|
||||||
194
resources/views/createProject.blade.php
Normal file
194
resources/views/createProject.blade.php
Normal file
|
|
@ -0,0 +1,194 @@
|
||||||
|
@extends('Templates/templateAdmin')
|
||||||
|
|
||||||
|
@section('Main-content')
|
||||||
|
<!-- Content Header (Page header) -->
|
||||||
|
<!-- /.content-header -->
|
||||||
|
|
||||||
|
@if (session('success'))
|
||||||
|
<div class="alert alert-success" role="alert">
|
||||||
|
{{ session('success') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="container mt-5">
|
||||||
|
<form>
|
||||||
|
@csrf
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="inputDocumento">Selecione um documento:</label>
|
||||||
|
<input type="file" class="form-control-file" id="inputDocumento" accept=".xlsx, .xls">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary">Enviar</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
<a id="btn-download-template" href="{{ route('download') }}" class="btn btn-warning">Baixar Template</a>
|
||||||
|
|
||||||
|
<div id="tabelaExcel" class="mt-5"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="tabelaExcel" class="mt-5"></div>
|
||||||
|
<div id="tabelaExcel1" class="mt-5"></div>
|
||||||
|
<div id="tabelaExcel2" class="mt-5"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- <script>
|
||||||
|
// Obtenha a URL da rota usando o método route()
|
||||||
|
const downloadUrl = "{{ route('download') }}";
|
||||||
|
|
||||||
|
// Atribua a URL ao atributo formaction do botão
|
||||||
|
document.getElementById('btn-download-template').setAttribute('formaction', downloadUrl);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
const tabelaExcel1 = document.getElementById('tabelaExcel1');
|
||||||
|
|
||||||
|
function handleFormSubmit(event) {
|
||||||
|
event.preventDefault(); // Previne o comportamento padrão do formulário
|
||||||
|
const inputFile = document.getElementById('inputDocumento').files[0];
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.readAsBinaryString(inputFile);
|
||||||
|
|
||||||
|
|
||||||
|
reader.onload = function() {
|
||||||
|
const fileData = reader.result;
|
||||||
|
const workbook = XLSX.read(fileData, {
|
||||||
|
type: 'binary'
|
||||||
|
});
|
||||||
|
const worksheet1 = workbook.Sheets[workbook.SheetNames[0]];
|
||||||
|
const tableData1 = XLSX.utils.sheet_to_json(worksheet1);
|
||||||
|
const slicedData = tableData1.slice(3); // cortar os dados a partir do array 3
|
||||||
|
|
||||||
|
// Enviar dados para o servidor via AJAX
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route('createEquipamentProject') }}", // rota do controlador
|
||||||
|
method: 'POST', // tipo de solicitação
|
||||||
|
data: {
|
||||||
|
data: slicedData
|
||||||
|
}, // dados para enviar, aqui enviamos os dados cortados
|
||||||
|
success: function(response) {
|
||||||
|
// Código para manipular a resposta, se necessário
|
||||||
|
},
|
||||||
|
error: function(jqXHR, textStatus, errorThrown) {
|
||||||
|
// Código para manipular erros, se necessário
|
||||||
|
}
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const form = document.querySelector('form'); form.addEventListener('submit',
|
||||||
|
handleFormSubmit);
|
||||||
|
})();
|
||||||
|
</script> --}}
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const downloadUrl = "{{ route('download') }}";
|
||||||
|
|
||||||
|
document.getElementById('btn-download-template').setAttribute('formaction', downloadUrl);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
const tabelaExcel1 = document.getElementById('tabelaExcel1');
|
||||||
|
|
||||||
|
function handleFormSubmit(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const inputFile = document.getElementById('inputDocumento').files[0];
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.readAsBinaryString(inputFile);
|
||||||
|
|
||||||
|
reader.onload = function() {
|
||||||
|
const fileData = reader.result;
|
||||||
|
const workbook = XLSX.read(fileData, {
|
||||||
|
type: 'binary'
|
||||||
|
});
|
||||||
|
const worksheet1 = workbook.Sheets[workbook.SheetNames[0]];
|
||||||
|
const tableData1 = XLSX.utils.sheet_to_json(worksheet1);
|
||||||
|
const slicedData = tableData1.slice(3);
|
||||||
|
|
||||||
|
console.log(slicedData);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route('createEquipamentProject') }}",
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
data: slicedData
|
||||||
|
},
|
||||||
|
// Uncomment these for debugging
|
||||||
|
// success: function(response) {
|
||||||
|
// console.log(response);
|
||||||
|
// },
|
||||||
|
// error: function(jqXHR, textStatus, errorThrown) {
|
||||||
|
// console.log(textStatus, errorThrown);
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const form = document.querySelector('form');
|
||||||
|
form.addEventListener('submit', handleFormSubmit);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{{--
|
||||||
|
// reader.onload = function() {
|
||||||
|
// const fileData = reader.result;
|
||||||
|
// const workbook = XLSX.read(fileData, {
|
||||||
|
// type: 'binary'
|
||||||
|
// });
|
||||||
|
// const worksheet1 = workbook.Sheets[workbook.SheetNames[0]];
|
||||||
|
// const tableData1 = XLSX.utils.sheet_to_json(worksheet1);
|
||||||
|
// const tabelaHtml1 = criarTabelaHtml(tableData1);
|
||||||
|
// const tabelaExcel1 = document.getElementById('tabelaExcel1');
|
||||||
|
// if (tabelaExcel1 !== null) {
|
||||||
|
// tabelaExcel1.innerHTML = tabelaHtml1;
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
|
||||||
|
// function criarTabelaHtml(dados) {
|
||||||
|
|
||||||
|
// const colunasObj = dados[2];
|
||||||
|
// const colunasheader = Object.keys(colunasObj).map(key =>
|
||||||
|
// colunasObj[key]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// const colunasHtml = colunasheader.map(coluna => `<th>${coluna}</th>`).join('');
|
||||||
|
|
||||||
|
// const colunas = Object.keys(dados[2]);
|
||||||
|
|
||||||
|
// const linhasHtml = dados
|
||||||
|
// .slice(3)
|
||||||
|
// .map(linha => {
|
||||||
|
// const celulasHtml = colunas.map(coluna => {
|
||||||
|
// const valor = linha[coluna] !== undefined ? linha[coluna] : 'NULL';
|
||||||
|
// return `<td>${valor}</td>`;
|
||||||
|
// }).join('');
|
||||||
|
// return `<tr>${celulasHtml}</tr>`;
|
||||||
|
// })
|
||||||
|
// .join('');
|
||||||
|
|
||||||
|
// // console.log()
|
||||||
|
// return `
|
||||||
|
// <table class="table table-bordered">
|
||||||
|
// <thead>
|
||||||
|
// <tr>${colunasHtml}</tr>
|
||||||
|
// </thead>
|
||||||
|
// <tbody>
|
||||||
|
// ${linhasHtml}
|
||||||
|
// </tbody>
|
||||||
|
// </table>
|
||||||
|
// `;
|
||||||
|
// } --}}
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
{{-- /.card-body --}}
|
||||||
</div>
|
</div>
|
||||||
{{-- ./card --}}
|
{{-- ./card --}}
|
||||||
|
|
||||||
|
|
|
||||||
408
resources/views/projectsClients/createProject.blade.php
Normal file
408
resources/views/projectsClients/createProject.blade.php
Normal file
|
|
@ -0,0 +1,408 @@
|
||||||
|
@extends('Templates/templateAdmin')
|
||||||
|
|
||||||
|
@section('Main-content')
|
||||||
|
<!-- Content Header (Page header) -->
|
||||||
|
<!-- /.content-header -->
|
||||||
|
@if (session('success'))
|
||||||
|
<div class="alert alert-success" role="alert">
|
||||||
|
{{ session('success') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="card-body">
|
||||||
|
<!-- progressbar -->
|
||||||
|
<ul id="progressbar" class="nav nav-pills flex-sm-row" style=" text-align: center;">
|
||||||
|
<li class="active flex-sm-fill">Project details</li>
|
||||||
|
<li class="flex-sm-fill">Articulated</li>
|
||||||
|
<li class="flex-sm-fill">Workstation</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Card details project -->
|
||||||
|
<fieldset>
|
||||||
|
<div class="card card-primary" id="CardDetalhes">
|
||||||
|
<div class="card-header bg-primary text-white">
|
||||||
|
<h3 class="card-title mb-0">Detalhes da Obra</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<form method="POST" action="{{ route('createProject1') }}" id="idDoFormulario">
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Descrição da obra</label>
|
||||||
|
<input type="text" name="description_project" class="form-control"
|
||||||
|
placeholder="Descrição da obra;">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Nº. obra ISPT</label>
|
||||||
|
<input type="number" name="n_project_ispt" class="form-control"
|
||||||
|
placeholder="Nº. obra ISPT…">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Responsável obra ISPT</label>
|
||||||
|
<input type="text" name="responsible_project_ispt" class="form-control"
|
||||||
|
placeholder="Responsável obra ISPT…">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Responsável obra Empresa</label>
|
||||||
|
<input type="text" name="responsible_project_company" class="form-control"
|
||||||
|
placeholder="Responsável obra cliente…">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6" id="companyField">
|
||||||
|
<label>Empresa</label>
|
||||||
|
<select class="form-control" name="user_id" id="company_select">
|
||||||
|
<option value="#">Selecione uma Empresa...</option>
|
||||||
|
@foreach ($companies as $company)
|
||||||
|
<option value="{{ $company->id }}">{{ $company->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6" id="installationField" hidden>
|
||||||
|
<label>Instalação</label>
|
||||||
|
<select class="form-control" name="installation_id" id="installationSelect">
|
||||||
|
|
||||||
|
<!-- As opções de instalação serão preenchidas dinamicamente -->
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" id="new_company_div">
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Nova Instalacao :</label>
|
||||||
|
<input type="text" id="new_company_name" class="form-control" name="new_company_name"
|
||||||
|
placeholder="Digite o nome da nova empresa">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Nova Localização</label>
|
||||||
|
<input type="text" class="form-control" name="new_company_address"
|
||||||
|
placeholder="Localização...">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group" id="localization_installation_client">
|
||||||
|
<label>Localização</label>
|
||||||
|
<input type="text" class="form-control" placeholder="Localização" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Nº. de obra cliente</label>
|
||||||
|
<input type="number" name="" class="form-control"
|
||||||
|
placeholder="Nº. de obra cliente…">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Date -->
|
||||||
|
<div class="form-group col-sm-6">
|
||||||
|
<label>Datas:</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text">
|
||||||
|
<i class="far fa-calendar-alt"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<input name="date_started" type="datetime-local" class="form-control float-right">
|
||||||
|
</div>
|
||||||
|
<!-- /.input group -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /.card-body -->
|
||||||
|
|
||||||
|
<div class="card-footer">
|
||||||
|
<div class="float-right">
|
||||||
|
<button type="submit" class="btn btn-primary">Guardar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{{-- /.card-body --}}
|
||||||
|
</div>
|
||||||
|
{{-- /.card card-primary --}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Card Articulado -->
|
||||||
|
{{-- <fieldset>
|
||||||
|
<div class="card card-primary">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">Articulated</h3>
|
||||||
|
</div>
|
||||||
|
<!-- ./Card-header -->
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Table articulado da obra -->
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">Tasks</h3>
|
||||||
|
</div>
|
||||||
|
<!-- /.card-header -->
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="container mt-5">
|
||||||
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="inputDocumento">Selecione um documento:</label>
|
||||||
|
<input type="file" class="form-control-file" id="inputDocumento"
|
||||||
|
accept=".xlsx, .xls">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary">Enviar</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
<button id="btn-download-template" type="submit" class="btn btn-warning">Baixar
|
||||||
|
Template</button>
|
||||||
|
|
||||||
|
<div id="tabelaExcel" class="mt-5"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="tabelaExcel" class="mt-5"></div>
|
||||||
|
<div id="tabelaExcel1" class="mt-5"></div>
|
||||||
|
<div id="tabelaExcel2" class="mt-5"></div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /.card-body -->
|
||||||
|
</div>
|
||||||
|
<!-- /. Table articulado da obra-->
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- ./Card-body -->
|
||||||
|
</div>
|
||||||
|
<!-- ./Card card-primary -->
|
||||||
|
|
||||||
|
<input type="button" name="previous" class="btn btn-primary previous float-left" value="Previous" />
|
||||||
|
<input type="button" name="next" class="btn btn-primary next float-right" value="Próximo" />
|
||||||
|
</fieldset> --}}
|
||||||
|
|
||||||
|
<br>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /.content-wrapper -->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
var installationsData; // Esta variável irá armazenar as informações das instalações
|
||||||
|
$('#company_select').change(function() {
|
||||||
|
var user_id = $(this).val();
|
||||||
|
|
||||||
|
if (user_id == '#') {
|
||||||
|
$('#installationField').attr('hidden', 'hidden');
|
||||||
|
$('#localization_installation_client').hide();
|
||||||
|
$('#new_company_div').hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.get('/api/installations?user_id=' + user_id, function(data) {
|
||||||
|
|
||||||
|
var select = $('#installationSelect');
|
||||||
|
select.empty();
|
||||||
|
|
||||||
|
// Adicione as opções fixas aqui
|
||||||
|
select.append('<option value="#">Selecione uma instalação...</option>');
|
||||||
|
select.append(
|
||||||
|
'<option value="new_install">Criar uma nova Instalacao ?</option>');
|
||||||
|
|
||||||
|
// Agora você pode adicionar suas opções dinâmicas.
|
||||||
|
$.each(data, function(index, installation) {
|
||||||
|
|
||||||
|
select.append('<option value="' + installation.installation_ID +
|
||||||
|
'">' +
|
||||||
|
installation.installation_name + '</option>');
|
||||||
|
});
|
||||||
|
// Armazene os dados em installationsData
|
||||||
|
installationsData = data;
|
||||||
|
|
||||||
|
$('#installationField').removeAttr('hidden');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
// Adicione este código para lidar com a mudança na seleção da instalação
|
||||||
|
$('#installationSelect').change(function() {
|
||||||
|
if (this.value == 'new_install') {
|
||||||
|
$('#new_company_div').show();
|
||||||
|
$('#localization_installation_client').hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$('#new_company_div').hide();
|
||||||
|
$('#localization_installation_client').show();
|
||||||
|
|
||||||
|
if (this.value == '#') {
|
||||||
|
$('#new_company_div').hide();
|
||||||
|
$('#localization_installation_client').hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifique se installationsData está definido
|
||||||
|
if (installationsData) {
|
||||||
|
// Encontre a instalação selecionada nos dados da instalação
|
||||||
|
var selectedInstallation = installationsData.find(function(installation) {
|
||||||
|
return installation.installation_ID == this.value;
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
|
if (selectedInstallation) {
|
||||||
|
// Preencha o valor do campo de endereço com o endereço da instalação selecionada
|
||||||
|
$('#localization_installation_client input').val(selectedInstallation.address);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#localization_installation_client').hide();
|
||||||
|
$('#new_company_div').hide();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{{-- <script>
|
||||||
|
$('#new_company_div').hide();
|
||||||
|
|
||||||
|
$('#idDoFormulario').on('submit', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: $(this).attr('action'),
|
||||||
|
data: $(this).serialize(),
|
||||||
|
success: function(response) {
|
||||||
|
if (response.success) {
|
||||||
|
moveToNextFieldset
|
||||||
|
(); // Mover para o próximo fieldset se a solicitação for bem-sucedida
|
||||||
|
} else {
|
||||||
|
// Trate o caso em que a resposta foi bem-sucedida, mas o conteúdo da resposta indica um erro.
|
||||||
|
// Por exemplo, você pode mostrar uma mensagem de erro.
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(response) {
|
||||||
|
// Trate o caso em que a própria solicitação falhou.
|
||||||
|
// Por exemplo, você pode mostrar uma mensagem de erro.
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function moveToNextFieldset() {
|
||||||
|
if (animating) return;
|
||||||
|
|
||||||
|
animating = true;
|
||||||
|
current_fs = $('.active').parent();
|
||||||
|
next_fs = $('.active').parent().next();
|
||||||
|
|
||||||
|
$("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
|
||||||
|
|
||||||
|
next_fs.show();
|
||||||
|
current_fs.animate({
|
||||||
|
opacity: 0
|
||||||
|
}, {
|
||||||
|
step: function(now, mx) {
|
||||||
|
scale = 1 - (1 - now) * 0.2;
|
||||||
|
left = (now * 50) + "%";
|
||||||
|
opacity = 1 - now;
|
||||||
|
current_fs.css({
|
||||||
|
'transform': 'scale(' + scale + ')',
|
||||||
|
'position': 'absolute'
|
||||||
|
});
|
||||||
|
next_fs.css({
|
||||||
|
'left': left,
|
||||||
|
'opacity': opacity
|
||||||
|
});
|
||||||
|
},
|
||||||
|
duration: 800,
|
||||||
|
complete: function() {
|
||||||
|
current_fs.hide();
|
||||||
|
animating = false;
|
||||||
|
},
|
||||||
|
easing: 'easeInOutBack'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script> --}}
|
||||||
|
|
||||||
|
{{-- Script Articlado --}}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
// Atribua a URL ao atributo formaction do botão
|
||||||
|
document.getElementById('btn-download-template').setAttribute('formaction', downloadUrl);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
const tabelaExcel1 = document.getElementById('tabelaExcel1');
|
||||||
|
|
||||||
|
function handleFormSubmit(event) {
|
||||||
|
event.preventDefault(); // Previne o comportamento padrão do formulário
|
||||||
|
const inputFile = document.getElementById('inputDocumento').files[0];
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.readAsBinaryString(inputFile);
|
||||||
|
reader.onload = function() {
|
||||||
|
const fileData = reader.result;
|
||||||
|
const workbook = XLSX.read(fileData, {
|
||||||
|
type: 'binary'
|
||||||
|
});
|
||||||
|
const worksheet1 = workbook.Sheets[workbook.SheetNames[0]];
|
||||||
|
const tableData1 = XLSX.utils.sheet_to_json(worksheet1);
|
||||||
|
const tabelaHtml1 = criarTabelaHtml(tableData1);
|
||||||
|
const tabelaExcel1 = document.getElementById('tabelaExcel1');
|
||||||
|
if (tabelaExcel1 !== null) {
|
||||||
|
tabelaExcel1.innerHTML = tabelaHtml1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function criarTabelaHtml(dados) {
|
||||||
|
|
||||||
|
const colunasObj = dados[2];
|
||||||
|
const colunasheader = Object.keys(colunasObj).map(key =>
|
||||||
|
colunasObj[key]);
|
||||||
|
|
||||||
|
console.log(dados);
|
||||||
|
|
||||||
|
const colunasHtml = colunasheader.map(coluna => `<th>${coluna}</th>`).join('');
|
||||||
|
|
||||||
|
const colunas = Object.keys(dados[2]);
|
||||||
|
|
||||||
|
const linhasHtml = dados
|
||||||
|
.slice(3)
|
||||||
|
.map(linha => {
|
||||||
|
const celulasHtml = colunas.map(coluna => {
|
||||||
|
const valor = linha[coluna] !== undefined ? linha[coluna] : 'NULL';
|
||||||
|
return `<td>${valor}</td>`;
|
||||||
|
}).join('');
|
||||||
|
return `<tr>${celulasHtml}</tr>`;
|
||||||
|
})
|
||||||
|
.join('');
|
||||||
|
|
||||||
|
// console.log()
|
||||||
|
return `
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>${colunasHtml}</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
${linhasHtml}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const form = document.querySelector('form');
|
||||||
|
form.addEventListener('submit', handleFormSubmit);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
@ -23,14 +23,45 @@
|
||||||
|
|
||||||
use App\Http\Controllers\CustomRegistrationController;
|
use App\Http\Controllers\CustomRegistrationController;
|
||||||
|
|
||||||
|
use App\Http\Controllers\CreateProjectController;
|
||||||
|
|
||||||
|
|
||||||
Route::get('/download-template', function () {
|
|
||||||
$filePath = public_path('templateExcel/FinalTemplate .xlsx');
|
|
||||||
$fileName = 'FinalTemplate .xlsx';
|
|
||||||
|
Route::get('/template', function () {
|
||||||
|
$filePath = public_path('templateExcel/FinalTemplate1.xlsx');
|
||||||
|
$fileName = 'Valves_Template.xlsx';
|
||||||
|
|
||||||
return response()->download($filePath, $fileName);
|
return response()->download($filePath, $fileName);
|
||||||
});
|
})->name('download');
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Create Project
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here is where you can register web routes for your application. These
|
||||||
|
| routes are loaded by the RouteServiceProvider and all of them will
|
||||||
|
| be assigned to the "web" middleware group. Make something great!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
route::get('createProject', [CreateProjectController::class,'listCompanies'])->name('createProject');
|
||||||
|
|
||||||
|
route::post('createProject1',[CreateProjectController::class,'createProject'])->name('createProject1');
|
||||||
|
|
||||||
|
// route::get('testExcel', function(){
|
||||||
|
// return view('testExcel');
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
Route::post('/create-equipament-project', [CreateProjectController::class,'createEquipamentProject'])->name('createEquipamentProject');
|
||||||
|
|
||||||
|
|
||||||
|
/* Api */
|
||||||
|
Route::get('/api/installations/', [CreateProjectController::class, 'getByUserNif']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -46,6 +77,11 @@
|
||||||
})->name('verification.notice');
|
})->name('verification.notice');
|
||||||
|
|
||||||
|
|
||||||
|
Route::get('/testExcel', function(){
|
||||||
|
return view('createProject');
|
||||||
|
})->name('testExcel');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Web Routes
|
| Web Routes
|
||||||
|
|
@ -106,6 +142,7 @@
|
||||||
Route::delete('users/{user}', [UserController::class, 'destroy'])->name('users.destroy');
|
Route::delete('users/{user}', [UserController::class, 'destroy'])->name('users.destroy');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Create Users with Super Admin
|
| Create Users with Super Admin
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user