Test to use snappy pdf, but only with Dompdf were we able to make the reports.
Create a reporting system, in which reporting by Ambit has already been completed.
This commit is contained in:
parent
b29188b29e
commit
d7e3a725ac
110
app/DataTables/UsersDataTable.php
Normal file
110
app/DataTables/UsersDataTable.php
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
|
||||
namespace App\DataTables;
|
||||
|
||||
use App\Models\Equipment;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
||||
use Yajra\DataTables\EloquentDataTable;
|
||||
use Yajra\DataTables\Html\Builder as HtmlBuilder;
|
||||
use Yajra\DataTables\Html\Button;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use Yajra\DataTables\Html\Editor\Editor;
|
||||
use Yajra\DataTables\Html\Editor\Fields;
|
||||
use Yajra\DataTables\Services\DataTable;
|
||||
|
||||
class UsersDataTable extends DataTable
|
||||
{
|
||||
/**
|
||||
* Build the DataTable class.
|
||||
*
|
||||
* @param QueryBuilder $query Results from query() method.
|
||||
*/
|
||||
public function dataTable(QueryBuilder $query): EloquentDataTable
|
||||
{
|
||||
return (new EloquentDataTable($query))
|
||||
->addColumn('action', 'users.action')
|
||||
->setRowId('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the query source of dataTable.
|
||||
*/
|
||||
// public function query(User $model): QueryBuilder
|
||||
// {
|
||||
// return $model->newQuery();
|
||||
// }
|
||||
|
||||
public function query()
|
||||
{
|
||||
$query = Equipment::select(['ispt_number', 'unit_id', 'equipment_tag']);
|
||||
return $this->applyScopes($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional method if you want to use the html builder.
|
||||
*/
|
||||
// public function html(): HtmlBuilder
|
||||
// {
|
||||
// return $this->builder()
|
||||
// ->setTableId('users-table')
|
||||
// ->columns($this->getColumns())
|
||||
// ->minifiedAjax()
|
||||
// //->dom('Bfrtip')
|
||||
// ->orderBy(1)
|
||||
// ->selectStyleSingle()
|
||||
// ->buttons([
|
||||
// // Button::make('excel'),
|
||||
// // Button::make('csv'),
|
||||
// Button::make('pdf'),
|
||||
// // Button::make('print'),
|
||||
// // Button::make('reset'),
|
||||
// // Button::make('reload')
|
||||
// ]);
|
||||
// }
|
||||
public function html()
|
||||
{
|
||||
return $this->builder()
|
||||
->setTableId('Equipments')
|
||||
->columns($this->getColumns())
|
||||
// Outras configurações necessárias ...
|
||||
->minifiedAjax()
|
||||
->dom('Bfrtip')
|
||||
->orderBy(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the dataTable columns definition.
|
||||
*/
|
||||
// public function getColumns(): array
|
||||
// {
|
||||
// return [
|
||||
// Column::computed('action')
|
||||
// ->exportable(false)
|
||||
// ->printable(false)
|
||||
// ->width(60)
|
||||
// ->addClass('text-center'),
|
||||
// Column::make('id'),
|
||||
// Column::make('add your columns'),
|
||||
// Column::make('created_at'),
|
||||
// Column::make('updated_at'),
|
||||
// ];
|
||||
// }
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
'ispt_number',
|
||||
'unit_id',
|
||||
'equipment_tag',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filename for export.
|
||||
*/
|
||||
protected function filename(): string
|
||||
{
|
||||
return 'Users_' . date('YmdHis');
|
||||
}
|
||||
}
|
||||
|
|
@ -19,23 +19,66 @@
|
|||
|
||||
class ClientController extends Controller
|
||||
{
|
||||
public function showReportingForAmbitsProject($dataAmbit, $projectId)
|
||||
|
||||
public function showReportingForAmbitsProject($ambitId, $projectId)
|
||||
{
|
||||
$dataAmbit = AmbitsEquipment::where('ambits_id', $ambitId)->first();
|
||||
// $receiveDataEquipments = Equipment::where('company_projects_id', $projectId)->get();
|
||||
|
||||
return view('userClient.showReportingAllEquipmentsForAmbitProject', compact('ambitId', 'projectId','dataAmbit'));
|
||||
|
||||
}
|
||||
public function getEquipmentsOfAmbit(Request $request)
|
||||
{
|
||||
|
||||
$projectId = $request->get('projectId');
|
||||
$ambitId = $request->get('ambitId');
|
||||
|
||||
$dataAmbit = AmbitsEquipment::where('ambits_id', $ambitId)->first();
|
||||
|
||||
$receiveDataEquipments = Equipment::where('company_projects_id', $projectId)->get();
|
||||
|
||||
$filteredAssociations = EquipmentAssociationAmbit::where('ambits_id', $dataAmbit->ambits_id)
|
||||
->whereIn('equipment_id', $receiveDataEquipments->pluck('equipment_id'))
|
||||
->get();
|
||||
|
||||
$query = Equipment::whereIn('equipment_id', $filteredAssociations->pluck('equipment_id'))->get();
|
||||
// $query = Equipment::select(['ispt_number', 'unit_id', 'equipment_tag'])->get();
|
||||
|
||||
return DataTables::of($query)
|
||||
// Adicione aqui qualquer manipulação de dados ou colunas adicionais que você precise
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
public function showReportingForAmbitsProjectPdf($ambitId, $projectId)
|
||||
{
|
||||
// Obter o caminho da imagem do usuário ou uma imagem padrão
|
||||
$userLogoPath = Auth::user()->user_logo ? public_path('user_logos/' . Auth::user()->user_logo) : public_path('user_logos/logoISPT4.0.jpg');
|
||||
|
||||
// $pdf = PDF::loadView('userClient.pdfReportings.showReportingAllEquipmentsForAmbitProject', [
|
||||
// 'userLogoPath' => $userLogoPath,
|
||||
// 'dataAmbit' => $dataAmbit,
|
||||
// 'projectId' => $projectId
|
||||
// ])->setPaper('a4', 'landscape');
|
||||
// return $pdf->stream('relatorio_teste.pdf');
|
||||
$dataAmbit = AmbitsEquipment::where('ambits_id', $ambitId)->first();
|
||||
|
||||
return view('userClient.pdfReportings.showReportingAllEquipmentsForAmbitProject', [
|
||||
$receiveDataEquipments = Equipment::where('company_projects_id', $projectId)->get();
|
||||
|
||||
$filteredAssociations = EquipmentAssociationAmbit::where('ambits_id', $dataAmbit->ambits_id)
|
||||
->whereIn('equipment_id', $receiveDataEquipments->pluck('equipment_id'))
|
||||
->get();
|
||||
|
||||
$equipmentDetails = Equipment::whereIn('equipment_id', $filteredAssociations->pluck('equipment_id'))->get();
|
||||
|
||||
$pdf = PDF::loadView('userClient.pdfReportings.equipmentsForAmbitPdf', [
|
||||
'equipmentDetails' => $equipmentDetails,
|
||||
'userLogoPath' => $userLogoPath,
|
||||
'dataAmbit' => $dataAmbit,
|
||||
'projectId' => $projectId
|
||||
]);
|
||||
])->setPaper('a4', 'landscape');
|
||||
return $pdf->stream('relatorio_teste.pdf');
|
||||
|
||||
// return view('userClient.pdfReportings.showReportingAllEquipmentsForAmbitProject', [
|
||||
// 'userLogoPath' => $userLogoPath,
|
||||
// 'dataAmbit' => $dataAmbit,
|
||||
// 'projectId' => $projectId
|
||||
// ]);
|
||||
}
|
||||
|
||||
public function getDataAllEquipmentsForAmbitOfProject(Request $request)
|
||||
|
|
@ -62,8 +105,8 @@ public function getDataAllEquipmentsForAmbitOfProject(Request $request)
|
|||
$equipmentsQuery = Equipment::whereIn('equipment_id', $equipmentsOfProject)
|
||||
->whereHas('equipmentAssociationAmbit', function ($q) use ($dataAmbit) {
|
||||
$q->where('ambits_id', $dataAmbit);
|
||||
})
|
||||
->select(['equipment_id','ispt_number', 'unit_id', 'equipment_tag']); // Selecionar apenas as colunas necessárias
|
||||
})
|
||||
->select(['equipment_id', 'ispt_number', 'unit_id', 'equipment_tag']); // Selecionar apenas as colunas necessárias
|
||||
|
||||
// Utilize o Yajra DataTables para formatar a resposta
|
||||
return DataTables::of($equipmentsQuery)
|
||||
|
|
@ -92,7 +135,7 @@ public function getDataAmbitsOfProject(Request $request)
|
|||
})->count();
|
||||
})
|
||||
->addColumn('action', function ($dataAmbitProject) use ($projectId) { // Incluindo $projectId no escopo da função anônima
|
||||
$actionBtn = '<a title="Detalhes do equipamento" href="' . route('showReportingForAmbitsProject', ['dataAmbit' => $dataAmbitProject->ambits_id, 'projectId' => $projectId]) . '"><i class="fa-solid fa-eye text-primary"></i></a>';
|
||||
$actionBtn = '<a title="Detalhes do equipamento" href="' . route('showReportingForAmbitsProject', ['ambitId' => $dataAmbitProject->ambits_id, 'projectId' => $projectId]) . '"><i class="fa-solid fa-eye text-primary"></i></a>';
|
||||
return $actionBtn;
|
||||
})
|
||||
->make(true);
|
||||
|
|
@ -161,7 +204,6 @@ public function showDataDetailsProjectClient($projectID)
|
|||
// Recebe os dados de cada Ambito
|
||||
$receiveDataAmbitsProject = AmbitsEquipment::whereIn('ambits_id', $AmbitsId)->get();
|
||||
|
||||
|
||||
return view('userClient.showDataDetailsProjectClient', compact('receiveDataProject', 'receiveUnitsOfProject', 'receiveAllTypeEquipments', 'receiveDataAmbitsProject', 'AmbitsIdString'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -849,7 +849,7 @@ public function receiveIdEquipment(Equipment $equipment)
|
|||
|
||||
public function processStep2(Request $request)
|
||||
{
|
||||
|
||||
// dd($request);
|
||||
// Valide e processe os dados do formulário
|
||||
$file = $request->file('documento');
|
||||
|
||||
|
|
@ -867,12 +867,15 @@ public function processStep2(Request $request)
|
|||
// Obtenha a primeira planilha, onde fica os nomes chaves para associar a tabela : general_attributes_equipaments
|
||||
$worksheet = $spreadsheet->getSheet(0);
|
||||
|
||||
|
||||
// Transforme os dados da planilha em um array
|
||||
$data = $worksheet->toArray();
|
||||
|
||||
// Retorna um array com todos os names preenchidos na primeira linha do template de Excel
|
||||
$nomesColunas = $data[0];
|
||||
|
||||
// dd($nomesColunas);
|
||||
|
||||
$countPendingEquipments = 0;
|
||||
$countNewEquipment = 0;
|
||||
|
||||
|
|
@ -893,7 +896,7 @@ public function processStep2(Request $request)
|
|||
continue;
|
||||
}
|
||||
|
||||
// Em cada um das linhas horizontais do excel, vai se guardar a 'key' vinculada ao valor do campo preenchido ou seja a 'key' vai ter o mesmo nome de um dos dados da tabela : general_attributes_equipaments na coluna : general_attributes_equipment_description, assim sendo mais facil implementar na tabela : specific_attributes_equipament_types
|
||||
// Em cada um das linhas horizontais do excel, vai se guardar a 'key' vinculada ao valor do campo preenchido ou seja a 'key' vai ter o mesmo nome de um dos dados da tabela 'general_attributes_equipaments' na coluna : general_attributes_equipment_description, assim sendo mais facil implementar na tabela : specific_attributes_equipament_types
|
||||
$juntarArrays = array_combine($nomesColunas, $dadosLinha);
|
||||
|
||||
// vai guardar todos os campos de possiveis novos equipamentos, cada um em um array para multiplos inserts, na base de dados
|
||||
|
|
@ -902,14 +905,14 @@ public function processStep2(Request $request)
|
|||
}, ARRAY_FILTER_USE_KEY);
|
||||
|
||||
//Indentifica qual o tipo de equipamento selecionado de acordo com a tabela EquipmentType
|
||||
$equipmentType = EquipmentType::where('equipment_type_name', $datas['tipo_equipamento'])->first();
|
||||
$equipmentType = EquipmentType::where('equipment_type_name', $datas['equipment_type_name'])->first();
|
||||
|
||||
$checkFactory = Unit::where('unit_name', $datas['fabrica'])->first();
|
||||
$checkFactory = Unit::where('unit_name', $datas['unit'])->first();
|
||||
|
||||
// Antes de criar o novo equipamento, verifique se já existe um equipamento
|
||||
// com o mesmo factory_id e tag.
|
||||
$existingEquipment = Equipment::where('unit_id', $checkFactory->unit_id)
|
||||
->where('equipment_tag', $datas['tag'])
|
||||
->where('equipment_tag', $datas['equipment_tag'])
|
||||
->first();
|
||||
|
||||
if ($existingEquipment) {
|
||||
|
|
@ -938,10 +941,11 @@ public function processStep2(Request $request)
|
|||
|
||||
$newEquipament->unit_id = $checkFactory->unit_id;
|
||||
$newEquipament->equipment_type_id = $equipmentType->equipment_type_id;
|
||||
$newEquipament->equipment_Description = $datas['equipment_Description'];
|
||||
$newEquipament->equipment_tag = $datas['tag'];
|
||||
$newEquipament->equipment_serial_number = $datas['n_serie'];
|
||||
$newEquipament->equipment_model = $datas['modelo'];
|
||||
$newEquipament->equipment_Description = $datas['equipment_description'];
|
||||
$newEquipament->equipment_tag = $datas['equipment_tag'];
|
||||
$newEquipament->equipment_serial_number = $datas['equipment_serial_number'];
|
||||
$newEquipament->equipment_brand = $datas['equipment_brand'];
|
||||
$newEquipament->equipment_model = $datas['equipment_model'];
|
||||
$newEquipament->ispt_number = $isptNumber;
|
||||
$newEquipament->company_projects_id = $company_projects_id;
|
||||
|
||||
|
|
@ -955,7 +959,8 @@ public function processStep2(Request $request)
|
|||
$receveEquipment_ID = $newEquipament->equipment_id;
|
||||
$receveEquipament_type_ID = $newEquipament->equipment_type_id;
|
||||
|
||||
$ambit = AmbitsEquipment::where('ambits_description', $datas['ambito'])->first();
|
||||
|
||||
$ambit = AmbitsEquipment::where('ambits_description', $datas['ambit'])->first();
|
||||
|
||||
if ($ambit) {
|
||||
$ambit_id = $ambit->ambits_id;
|
||||
|
|
@ -987,18 +992,19 @@ public function processStep2(Request $request)
|
|||
|
||||
$generalAttributes = GeneralAttributesEquipment::all();
|
||||
|
||||
|
||||
foreach ($generalAttributes as $generalAttribute) {
|
||||
// Verifica se a chave existe em $datas, comparando com os dados da tabela : GeneralAttributesEquipment assim adicionando todos diferentes de NULL relacionados com o equipamento acabado de cria
|
||||
if (isset($datas[$generalAttribute->general_attributes_equipment_description])) {
|
||||
$specificAttribute = new SpecificAttributesEquipmentType;
|
||||
|
||||
$specificAttribute = new SpecificAttributesEquipmentType;
|
||||
$specificAttribute->equipment_id = $receveEquipment_ID;
|
||||
$specificAttribute->equipment_type_id = $receveEquipament_type_ID;
|
||||
$specificAttribute->general_attributes_equipment_id = $generalAttribute->general_attributes_equipment_id;
|
||||
// Atribui o valor da chave correspondente em $datas
|
||||
$specificAttribute->specific_attributes_value = $datas[$generalAttribute->general_attributes_equipment_description];
|
||||
|
||||
// $specificAttribute->save();
|
||||
$specificAttribute->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,8 +53,16 @@ protected function getAllowedRoutesForUserType($userType)
|
|||
switch ($userType) {
|
||||
case 5: // Técnico
|
||||
return ['enterWorkstation', 'getEquipmentData', 'receiveAnswersEquipment'];
|
||||
case 3: // Empresa
|
||||
return ['dashboardClient', 'manageAssetsClient', 'ExecutionProject','reportingDataClient'];
|
||||
case 3:
|
||||
// Empresa
|
||||
return ['dashboardClient','reportingDataClient', 'manageAssetsClient',
|
||||
// Obras em Execussao
|
||||
'ExecutionProject',
|
||||
//Relatorios
|
||||
'showDataDetailsProjectClient','showReportingForAmbitsProject',
|
||||
//Api.s
|
||||
'getDataAmbitsOfProject','getDataEquipmentsOfProject','getEquipmentsOfAmbit'
|
||||
];
|
||||
|
||||
// Adicione mais casos conforme necessário...
|
||||
default:
|
||||
|
|
|
|||
11
app/Models/EquipmentWorkHistory.php
Normal file
11
app/Models/EquipmentWorkHistory.php
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EquipmentWorkHistory extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
"phpoffice/phpspreadsheet": "^1.28",
|
||||
"symfony/http-client": "^6.2",
|
||||
"symfony/mailgun-mailer": "^6.2",
|
||||
"yajra/laravel-datatables-buttons": "^10.0",
|
||||
"yajra/laravel-datatables-oracle": "^10.3.1"
|
||||
},
|
||||
"require-dev": {
|
||||
|
|
|
|||
158
composer.lock
generated
158
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "2c3be9f9e59932faad647aeddf8dfeb6",
|
||||
"content-hash": "94bd00d99da5a6ebf03ba946180bb306",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bacon/bacon-qr-code",
|
||||
|
|
@ -6756,6 +6756,162 @@
|
|||
},
|
||||
"time": "2022-06-03T18:03:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "yajra/laravel-datatables-buttons",
|
||||
"version": "v10.0.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/yajra/laravel-datatables-buttons.git",
|
||||
"reference": "cdd2b907f892cba4b840b4ed14f73bc73086d0cf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/yajra/laravel-datatables-buttons/zipball/cdd2b907f892cba4b840b4ed14f73bc73086d0cf",
|
||||
"reference": "cdd2b907f892cba4b840b4ed14f73bc73086d0cf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/console": "^10",
|
||||
"php": "^8.1",
|
||||
"yajra/laravel-datatables-html": "^10",
|
||||
"yajra/laravel-datatables-oracle": "^10"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-snappy": "^1.0.1",
|
||||
"maatwebsite/excel": "^3.1.46",
|
||||
"nunomaduro/larastan": "^2.4",
|
||||
"orchestra/testbench": "^8",
|
||||
"rap2hpoutre/fast-excel": "^5.1"
|
||||
},
|
||||
"suggest": {
|
||||
"barryvdh/laravel-snappy": "Allows exporting of dataTable to PDF using the print view.",
|
||||
"dompdf/dompdf": "Allows exporting of dataTable to PDF using the DomPDF.",
|
||||
"maatwebsite/excel": "Exporting of dataTables (excel, csv and PDF) using maatwebsite package.",
|
||||
"rap2hpoutre/fast-excel": "Faster exporting of dataTables using fast-excel package.",
|
||||
"yajra/laravel-datatables-export": "Exporting of dataTables (excel, csv and PDF) via livewire and queue worker."
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "10.0-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Yajra\\DataTables\\ButtonsServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Yajra\\DataTables\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Arjay Angeles",
|
||||
"email": "aqangeles@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Laravel DataTables Buttons Plugin.",
|
||||
"keywords": [
|
||||
"buttons",
|
||||
"datatables",
|
||||
"jquery",
|
||||
"laravel"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/yajra/laravel-datatables-buttons/issues",
|
||||
"source": "https://github.com/yajra/laravel-datatables-buttons/tree/v10.0.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sponsors/yajra",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-11-15T06:05:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "yajra/laravel-datatables-html",
|
||||
"version": "v10.12.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/yajra/laravel-datatables-html.git",
|
||||
"reference": "1c0fc1ff2026457ff29ab1a6a3433a44d59b251d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/yajra/laravel-datatables-html/zipball/1c0fc1ff2026457ff29ab1a6a3433a44d59b251d",
|
||||
"reference": "1c0fc1ff2026457ff29ab1a6a3433a44d59b251d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"php": "^8.1",
|
||||
"yajra/laravel-datatables-oracle": "^10.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"nunomaduro/larastan": "^2.4",
|
||||
"orchestra/testbench": "^7.21"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "10.0-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Yajra\\DataTables\\HtmlServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Yajra\\DataTables\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Arjay Angeles",
|
||||
"email": "aqangeles@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Laravel DataTables HTML builder plugin for Laravel 5.4+.",
|
||||
"keywords": [
|
||||
"JS",
|
||||
"datatables",
|
||||
"html",
|
||||
"jquery",
|
||||
"laravel"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/yajra/laravel-datatables-html/issues",
|
||||
"source": "https://github.com/yajra/laravel-datatables-html/tree/v10.12.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://www.paypal.me/yajra",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/yajra",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://www.patreon.com/yajra",
|
||||
"type": "patreon"
|
||||
}
|
||||
],
|
||||
"time": "2023-12-15T04:41:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "yajra/laravel-datatables-oracle",
|
||||
"version": "v10.6.0",
|
||||
|
|
|
|||
91
config/datatables-buttons.php
Normal file
91
config/datatables-buttons.php
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
* Namespaces used by the generator.
|
||||
*/
|
||||
'namespace' => [
|
||||
/*
|
||||
* Base namespace/directory to create the new file.
|
||||
* This is appended on default Laravel namespace.
|
||||
* Usage: php artisan datatables:make User
|
||||
* Output: App\DataTables\UserDataTable
|
||||
* With Model: App\User (default model)
|
||||
* Export filename: users_timestamp
|
||||
*/
|
||||
'base' => 'DataTables',
|
||||
|
||||
/*
|
||||
* Base namespace/directory where your model's are located.
|
||||
* This is appended on default Laravel namespace.
|
||||
* Usage: php artisan datatables:make Post --model
|
||||
* Output: App\DataTables\PostDataTable
|
||||
* With Model: App\Post
|
||||
* Export filename: posts_timestamp
|
||||
*/
|
||||
'model' => 'App\\Models',
|
||||
],
|
||||
|
||||
/*
|
||||
* Set Custom stub folder
|
||||
*/
|
||||
//'stub' => '/resources/custom_stub',
|
||||
|
||||
/*
|
||||
* PDF generator to be used when converting the table to pdf.
|
||||
* Available generators: excel, snappy
|
||||
* Snappy package: barryvdh/laravel-snappy
|
||||
* Excel package: maatwebsite/excel
|
||||
*/
|
||||
'pdf_generator' => 'snappy',
|
||||
|
||||
/*
|
||||
* Snappy PDF options.
|
||||
*/
|
||||
'snappy' => [
|
||||
'options' => [
|
||||
'no-outline' => true,
|
||||
'margin-left' => '0',
|
||||
'margin-right' => '0',
|
||||
'margin-top' => '10mm',
|
||||
'margin-bottom' => '10mm',
|
||||
],
|
||||
'orientation' => 'landscape',
|
||||
],
|
||||
|
||||
/*
|
||||
* Default html builder parameters.
|
||||
*/
|
||||
'parameters' => [
|
||||
'dom' => 'Bfrtip',
|
||||
'order' => [[0, 'desc']],
|
||||
'buttons' => [
|
||||
'excel',
|
||||
'csv',
|
||||
'pdf',
|
||||
'print',
|
||||
'reset',
|
||||
'reload',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* Generator command default options value.
|
||||
*/
|
||||
'generator' => [
|
||||
/*
|
||||
* Default columns to generate when not set.
|
||||
*/
|
||||
'columns' => 'id,add your columns,created_at,updated_at',
|
||||
|
||||
/*
|
||||
* Default buttons to generate when not set.
|
||||
*/
|
||||
'buttons' => 'excel,csv,pdf,print,reset,reload',
|
||||
|
||||
/*
|
||||
* Default DOM to generate when not set.
|
||||
*/
|
||||
'dom' => 'Bfrtip',
|
||||
],
|
||||
];
|
||||
284
public/vendor/datatables/buttons.server-side.js
vendored
Normal file
284
public/vendor/datatables/buttons.server-side.js
vendored
Normal file
|
|
@ -0,0 +1,284 @@
|
|||
(function ($, DataTable) {
|
||||
"use strict";
|
||||
|
||||
var _buildParams = function (dt, action, onlyVisibles) {
|
||||
var params = dt.ajax.params();
|
||||
params.action = action;
|
||||
params._token = $('meta[name="csrf-token"]').attr('content');
|
||||
|
||||
if (onlyVisibles) {
|
||||
params.visible_columns = _getVisibleColumns();
|
||||
} else {
|
||||
params.visible_columns = null;
|
||||
}
|
||||
|
||||
return params;
|
||||
};
|
||||
|
||||
var _getVisibleColumns = function () {
|
||||
|
||||
var visible_columns = [];
|
||||
$.each(DataTable.settings[0].aoColumns, function (key, col) {
|
||||
if (col.bVisible) {
|
||||
visible_columns.push(col.name);
|
||||
}
|
||||
});
|
||||
|
||||
return visible_columns;
|
||||
};
|
||||
|
||||
var _downloadFromUrl = function (url, params) {
|
||||
var postUrl = url + '/export';
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', postUrl, true);
|
||||
xhr.responseType = 'arraybuffer';
|
||||
xhr.onload = function () {
|
||||
if (this.status === 200) {
|
||||
var filename = "";
|
||||
var disposition = xhr.getResponseHeader('Content-Disposition');
|
||||
if (disposition && disposition.indexOf('attachment') !== -1) {
|
||||
var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
|
||||
var matches = filenameRegex.exec(disposition);
|
||||
if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
|
||||
}
|
||||
var type = xhr.getResponseHeader('Content-Type');
|
||||
|
||||
var blob = new Blob([this.response], {type: type});
|
||||
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
||||
// IE workaround for "HTML7007: One or more blob URLs were revoked by closing the blob for which they were created. These URLs will no longer resolve as the data backing the URL has been freed."
|
||||
window.navigator.msSaveBlob(blob, filename);
|
||||
} else {
|
||||
var URL = window.URL || window.webkitURL;
|
||||
var downloadUrl = URL.createObjectURL(blob);
|
||||
|
||||
if (filename) {
|
||||
// use HTML5 a[download] attribute to specify filename
|
||||
var a = document.createElement("a");
|
||||
// safari doesn't support this yet
|
||||
if (typeof a.download === 'undefined') {
|
||||
window.location = downloadUrl;
|
||||
} else {
|
||||
a.href = downloadUrl;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
}
|
||||
} else {
|
||||
window.location = downloadUrl;
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
URL.revokeObjectURL(downloadUrl);
|
||||
}, 100); // cleanup
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||
xhr.send($.param(params));
|
||||
};
|
||||
|
||||
var _buildUrl = function(dt, action) {
|
||||
var url = dt.ajax.url() || '';
|
||||
var params = dt.ajax.params();
|
||||
params.action = action;
|
||||
|
||||
if (url.indexOf('?') > -1) {
|
||||
return url + '&' + $.param(params);
|
||||
}
|
||||
|
||||
return url + '?' + $.param(params);
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.excel = {
|
||||
className: 'buttons-excel',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-file-excel-o"></i> ' + dt.i18n('buttons.excel', 'Excel');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = _buildUrl(dt, 'excel');
|
||||
window.location = url;
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.postExcel = {
|
||||
className: 'buttons-excel',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-file-excel-o"></i> ' + dt.i18n('buttons.excel', 'Excel');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = dt.ajax.url() || window.location.href;
|
||||
var params = _buildParams(dt, 'excel');
|
||||
|
||||
_downloadFromUrl(url, params);
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.postExcelVisibleColumns = {
|
||||
className: 'buttons-excel',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-file-excel-o"></i> ' + dt.i18n('buttons.excel', 'Excel (only visible columns)');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = dt.ajax.url() || window.location.href;
|
||||
var params = _buildParams(dt, 'excel', true);
|
||||
|
||||
_downloadFromUrl(url, params);
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.export = {
|
||||
extend: 'collection',
|
||||
|
||||
className: 'buttons-export',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-download"></i> ' + dt.i18n('buttons.export', 'Export') + ' <span class="caret"/>';
|
||||
},
|
||||
|
||||
buttons: ['csv', 'excel', 'pdf']
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.csv = {
|
||||
className: 'buttons-csv',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-file-excel-o"></i> ' + dt.i18n('buttons.csv', 'CSV');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = _buildUrl(dt, 'csv');
|
||||
window.location = url;
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.postCsvVisibleColumns = {
|
||||
className: 'buttons-csv',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-file-excel-o"></i> ' + dt.i18n('buttons.csv', 'CSV (only visible columns)');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = dt.ajax.url() || window.location.href;
|
||||
var params = _buildParams(dt, 'csv', true);
|
||||
|
||||
_downloadFromUrl(url, params);
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.postCsv = {
|
||||
className: 'buttons-csv',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-file-excel-o"></i> ' + dt.i18n('buttons.csv', 'CSV');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = dt.ajax.url() || window.location.href;
|
||||
var params = _buildParams(dt, 'csv');
|
||||
|
||||
_downloadFromUrl(url, params);
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.pdf = {
|
||||
className: 'buttons-pdf',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-file-pdf-o"></i> ' + dt.i18n('buttons.pdf', 'PDF');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = _buildUrl(dt, 'pdf');
|
||||
window.location = url;
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.postPdf = {
|
||||
className: 'buttons-pdf',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-file-pdf-o"></i> ' + dt.i18n('buttons.pdf', 'PDF');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = dt.ajax.url() || window.location.href;
|
||||
var params = _buildParams(dt, 'pdf');
|
||||
|
||||
_downloadFromUrl(url, params);
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.print = {
|
||||
className: 'buttons-print',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-print"></i> ' + dt.i18n('buttons.print', 'Print');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = _buildUrl(dt, 'print');
|
||||
window.location = url;
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.reset = {
|
||||
className: 'buttons-reset',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-undo"></i> ' + dt.i18n('buttons.reset', 'Reset');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
dt.search('');
|
||||
dt.columns().search('');
|
||||
dt.draw();
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.reload = {
|
||||
className: 'buttons-reload',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-refresh"></i> ' + dt.i18n('buttons.reload', 'Reload');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
dt.draw(false);
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.create = {
|
||||
className: 'buttons-create',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-plus"></i> ' + dt.i18n('buttons.create', 'Create');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
window.location = window.location.href.replace(/\/+$/, "") + '/create';
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof DataTable.ext.buttons.copyHtml5 !== 'undefined') {
|
||||
$.extend(DataTable.ext.buttons.copyHtml5, {
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-copy"></i> ' + dt.i18n('buttons.copy', 'Copy');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof DataTable.ext.buttons.colvis !== 'undefined') {
|
||||
$.extend(DataTable.ext.buttons.colvis, {
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-eye"></i> ' + dt.i18n('buttons.colvis', 'Column visibility');
|
||||
}
|
||||
});
|
||||
}
|
||||
})(jQuery, jQuery.fn.dataTable);
|
||||
|
|
@ -622,7 +622,7 @@ class="form-control card_inputs"
|
|||
<span class="input-group-text" id="form-dimension">
|
||||
<i class="fa-solid fa-ruler " style="color: #00B0EA;"></i>
|
||||
</span>
|
||||
<input type="text" name="attributes[8]"
|
||||
<input type="text" name=".[8]"
|
||||
class="form-control card_inputs" id="dimension"
|
||||
placeholder="Dimensão"
|
||||
aria-label="Dimensao Equipamento"
|
||||
|
|
|
|||
|
|
@ -1,120 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Documento Rotacionado</title>
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||
|
||||
<style>
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table,
|
||||
th,
|
||||
td {
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 5px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* h4 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.w-full {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.w-half {
|
||||
width: 50%;
|
||||
} */
|
||||
|
||||
/* .margin-top {
|
||||
margin-top: 1.25rem;
|
||||
}
|
||||
|
||||
.footer {
|
||||
font-size: 0.875rem;
|
||||
padding: 1rem;
|
||||
background-color: rgb(241 245 249);
|
||||
} */
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{{-- <div class="table-responsive table-container">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th colspan="13" style="background-color: #123456; border: 2px solid red;"> <!-- Substitua #123456 pela cor azul escura desejada -->
|
||||
<div style="display: flex; justify-content: space-between; align-items: center; height: 80px;border: 2px solid yellow;">
|
||||
<img src="{{ public_path('/img/ispt.jpg') }}" alt="Logo Esquerdo" style="opacity: .8; height: 80px;border: 2px solid green;"> <!-- Ajuste a altura conforme necessário -->
|
||||
<img src="{{ $userLogoPath }}" alt="User Logo" class="img-circle elevation-2 imgProfile editImg" style="opacity: .8; height: 80px;border: 2px solid green;"> <!-- Ajuste a altura conforme necessário -->
|
||||
</div>
|
||||
</th>
|
||||
</tr> --}}
|
||||
|
||||
<div class="table-responsive table-container">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th colspan="13" style="background-color: #123456;">
|
||||
<div style="display: flex; justify-content: space-around; align-items: center; height: 80px;">
|
||||
<img src="{{ public_path('/img/ispt.jpg') }}" alt="Logo Esquerdo"
|
||||
style="max-height: 80px; max-width: 40%; margin: 0 10px;">
|
||||
<img src="{{ $userLogoPath }}" alt="User Logo"
|
||||
style="max-height: 80px; max-width: 40%; margin: 0 10px;">
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Nº ISPT</th>
|
||||
<th>Unidade</th>
|
||||
<th>Tag Nº</th>
|
||||
<th>Dim</th>
|
||||
<th>#</th>
|
||||
<th>Localizacao</th>
|
||||
<th>PI&D</th>
|
||||
<th>Ambito</th>
|
||||
<th>Obsercoes</th>
|
||||
<th>Andaime</th>
|
||||
<th>Isolamento</th>
|
||||
<th>Grua</th>
|
||||
<th>Conclusao</th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
{{--
|
||||
<div class="container text-center">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
Column
|
||||
</div>
|
||||
<div class="col">
|
||||
Column
|
||||
</div>
|
||||
<div class="col">
|
||||
Column
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
</body>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous">
|
||||
</script>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,199 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Invoice</title>
|
||||
|
||||
<style>
|
||||
.navBar-box {
|
||||
width: 100%;
|
||||
height: 10%;
|
||||
background-color: #09255C;
|
||||
color: #fff
|
||||
/* display: flex;
|
||||
/* Usa Flexbox para alinhar as divs internas */
|
||||
/* justify-content: space-between; */
|
||||
/* Distribui o espaço uniformemente */
|
||||
}
|
||||
|
||||
.box {
|
||||
/* Como nao entende o flex-box, cada box vai pegar metade do conteudo pai */
|
||||
width: 33.33%;
|
||||
float: left;
|
||||
height: 65px;
|
||||
padding: 15px 0px 0px 25px;
|
||||
/* top right bottom left */
|
||||
|
||||
margin-bottom: 50%;
|
||||
}
|
||||
|
||||
.box-text {
|
||||
padding: 25px 0px 0px 50px;
|
||||
/* top right bottom left */
|
||||
height: 65px;
|
||||
|
||||
}
|
||||
|
||||
.last-box {
|
||||
text-align: center;
|
||||
padding: 15px 0px 0px 40px;
|
||||
/* top right bottom left */
|
||||
|
||||
}
|
||||
|
||||
.header-img {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
|
||||
.navBar {
|
||||
width: 100%;
|
||||
background-color: #EAF3F6;
|
||||
/* Fundo azul para a tabela navBar */
|
||||
border-spacing: 0;
|
||||
/* Remove o espaçamento padrão entre as células */
|
||||
border-collapse: collapse;
|
||||
/* Assegura que as bordas das células colidam */
|
||||
}
|
||||
|
||||
.navBar th,
|
||||
.navBar td {
|
||||
border: 1px solid #09255C;
|
||||
/* Aplica bordas a cada célula */
|
||||
text-align: center;
|
||||
/* Alinha o texto ao centro para todas as células */
|
||||
}
|
||||
|
||||
.titles {
|
||||
background-color: #00B0EA;
|
||||
/* Fundo verde para as células do título */
|
||||
}
|
||||
|
||||
.items {
|
||||
/* Mantém o texto centralizado para as linhas de item, já definido no .navBar th, .navBar td */
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
|
||||
/* .margin-top {
|
||||
margin-top: 10px;
|
||||
border: 1px solid red;
|
||||
} */
|
||||
|
||||
|
||||
.footer {
|
||||
width: 97%;
|
||||
height: 20px;
|
||||
font-size: 0.875rem;
|
||||
padding: 1rem;
|
||||
background-color: #09255C;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.last-footer {
|
||||
color:#09255C;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
{{-- <div class="margin-top">
|
||||
|
||||
<div class="navBar-box">
|
||||
|
||||
<div class="box">
|
||||
<img class="header-img"
|
||||
src="{{ public_path('/img/ispt/4.0/Ispt4.0_Símbolo_Fundo_Azul-Marinho@2x-100.jpg') }}"
|
||||
alt="Logo Esquerdo">
|
||||
</div>
|
||||
<div class="box box-text">{{ $dataAmbit->ambits_description }}</div>
|
||||
<div class="box last-box">
|
||||
<img class="header-img" src="{{ $userLogoPath }}" alt="User Logo">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="navBar">
|
||||
@php $count = 0; @endphp
|
||||
@foreach ($equipmentDetails as $equipmentDetail)
|
||||
@if ($count % 23 == 0)
|
||||
@if ($count != 0)
|
||||
</table>
|
||||
<div style="page-break-after: always;"></div>
|
||||
@endif
|
||||
<table class="navBar">
|
||||
<tr class="titles">
|
||||
<th>Nº ISPT</th>
|
||||
<th>Unidade</th>
|
||||
<th>Tag Nº</th>
|
||||
</tr>
|
||||
@endif
|
||||
<tr class="items">
|
||||
<td>{{ $equipmentDetail->equipment_id }}</td>
|
||||
<td>{{ $equipmentDetail->unit_id }}</td>
|
||||
<td>{{ $equipmentDetail->equipment_tag }}</td>
|
||||
</tr>
|
||||
@php $count++; @endphp
|
||||
@endforeach
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<div>ISPT 4.0</div>
|
||||
<div>Paginacao</div>
|
||||
</div> --}}
|
||||
|
||||
<body>
|
||||
@php $page = 1; @endphp
|
||||
@php $count = 0; @endphp
|
||||
@foreach ($equipmentDetails as $equipmentDetail)
|
||||
@if ($count % 25 == 0)
|
||||
@if ($count != 0)
|
||||
</table>
|
||||
<div class="footer">ISPT 4.0 - - Página {{ $page++ }}</div>
|
||||
@endif
|
||||
<div class="navBar-box">
|
||||
|
||||
<div class="box">
|
||||
<img class="header-img"
|
||||
src="{{ public_path('/img/ispt/4.0/Ispt4.0_Símbolo_Fundo_Azul-Marinho@2x-100.jpg') }}"
|
||||
alt="Logo Esquerdo">
|
||||
</div>
|
||||
<div class="box box-text">{{ $dataAmbit->ambits_description }}</div>
|
||||
<div class="box last-box">
|
||||
<img class="header-img" src="{{ $userLogoPath }}" alt="User Logo">
|
||||
</div>
|
||||
</div>
|
||||
<table class="navBar">
|
||||
<tr class="titles">
|
||||
<th>Nº ISPT</th>
|
||||
<th>Unidade</th>
|
||||
<th>Tag Nº</th>
|
||||
</tr>
|
||||
@endif
|
||||
<tr class="items">
|
||||
<td>{{ $equipmentDetail->equipment_id }}</td>
|
||||
<td>{{ $equipmentDetail->unit_id }}</td>
|
||||
<td>{{ $equipmentDetail->equipment_tag }}</td>
|
||||
</tr>
|
||||
@php $count++; @endphp
|
||||
@endforeach
|
||||
</table>
|
||||
{{-- <div class="footer last-footer">ISPT 4.0 - - Ultima Página</div> --}}
|
||||
<div class="footer last-footer">ISPT 4.0 - - Página {{ $page++ }}</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Documento Rotacionado</title>
|
||||
|
||||
<style>
|
||||
body,
|
||||
html {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* Estilos da tabela */
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table,
|
||||
th,
|
||||
td {
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 5px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
border: 1px solid green;
|
||||
}
|
||||
|
||||
.header-box:first-child {
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
border: 1px solid red;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.header-box:last-child {
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
border: 1px solid red;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.header-img {
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<input type="hidden" id="dataAmbit" value="{{$dataAmbit}}">
|
||||
|
||||
<input type="hidden" id="projectId" value="{{$projectId}}">
|
||||
|
||||
<div class="header">
|
||||
<div class="header-box">
|
||||
<img class="header-img" src="{{ public_path('/img/ispt.jpg') }}" alt="Logo Esquerdo">
|
||||
</div>
|
||||
<div class="header-box">
|
||||
<p>Lugar do Ambito</p>
|
||||
</div>
|
||||
<div class="header-box">
|
||||
<img class="header-img" src="{{ $userLogoPath }}" alt="User Logo">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table name="showAllEquipmentsForAmbitProject" class="table">
|
||||
<tr>
|
||||
<th>Nº ISPT</th>
|
||||
<th>Unidade</th>
|
||||
<th>Tag Nº</th>
|
||||
<th>Dim</th>
|
||||
<th>#</th>
|
||||
<th>Localizacao</th>
|
||||
<th>PI&D</th>
|
||||
<th>Ambito</th>
|
||||
<th>Obsercoes</th>
|
||||
<th>Andaime</th>
|
||||
<th>Isolamento</th>
|
||||
<th>Grua</th>
|
||||
<th>Conclusao</th>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
@section('scriptsTemplateAdmin')
|
||||
<script type="text/javascript">
|
||||
var dataTables;
|
||||
$(document).ready(function() {
|
||||
|
||||
dataTables = $('#getDataAllEquipmentsForAmbitOfProject').DataTable({
|
||||
responsive: true,
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: {
|
||||
// Rota para obter os valores para o Yajra
|
||||
url: '{{ route('getDataAllEquipmentsForAmbitOfProject') }}',
|
||||
type: 'GET',
|
||||
data: function(d) {
|
||||
// Busca diretamente o valor de um input tipo Hidden para buscar e enviar o valor do id do project atual
|
||||
d.dataAmbit = $('#dataAmbit').val();
|
||||
d.projectId = $('#projectId').val();
|
||||
}
|
||||
},
|
||||
columns: [{
|
||||
data: 'ambits_description',
|
||||
name: 'ambits_description'
|
||||
},
|
||||
{
|
||||
data: 'amountEquipment',
|
||||
name: 'amountEquipment'
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
@extends('Templates/templateAdmin')
|
||||
|
||||
@section('Main-content')
|
||||
<input type="hidden" id="dataAmbit" value="{{ $dataAmbit }}">
|
||||
|
||||
<input type="hidden" id="projectId" value="{{ $projectId }}">
|
||||
|
||||
|
||||
<fieldset class="content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="card card-primary">
|
||||
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Obrar Concluidas</h3>
|
||||
</div>
|
||||
<!--./card-header-->
|
||||
<div class="card-body">
|
||||
|
||||
<table id="showAllEquipmentsForAmbitProject" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nº ISPT</th>
|
||||
<th>Unidade</th>
|
||||
<th>Tag Nº</th>
|
||||
|
||||
<th>Dim</th>
|
||||
<th>#</th>
|
||||
<th>PI&D</th>
|
||||
<th>Obsercoes</th>
|
||||
<th>Andaime</th>
|
||||
<th>Isolamento</th>
|
||||
<th>Grua</th>
|
||||
<th>Conclusao</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
@endsection
|
||||
|
||||
|
||||
|
||||
@section('scriptsTemplateAdmin')
|
||||
<script type="text/javascript">
|
||||
var dataTables;
|
||||
$(document).ready(function() {
|
||||
|
||||
dataTables = $('#showAllEquipmentsForAmbitProject').DataTable({
|
||||
responsive: true,
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: {
|
||||
// Rota para obter os valores para o Yajra
|
||||
url: '{{ route('getDataAllEquipmentsForAmbitOfProject') }}',
|
||||
type: 'GET',
|
||||
data: function(d) {
|
||||
// Busca diretamente o valor de um input tipo Hidden para buscar e enviar o valor do id do project atual
|
||||
d.dataAmbit = $('#dataAmbit').val();
|
||||
d.projectId = $('#projectId').val();
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
data: 'ispt_number',
|
||||
name: 'ispt_number'
|
||||
},
|
||||
{
|
||||
data: 'unit_id',
|
||||
name: 'unit_id'
|
||||
},
|
||||
{
|
||||
data: 'equipment_tag',
|
||||
name: 'equipment_tag'
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -1,12 +1,28 @@
|
|||
@extends('Templates/templateAdmin')
|
||||
|
||||
@section('Main-content')
|
||||
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1>Relatorios</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item active">Obras Concluidas</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<fieldset class="content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="card card-primary">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Obrar Concluidas</h3>
|
||||
<h3 class="card-title">Obras Concluidas</h3>
|
||||
</div>
|
||||
<!--./card-header-->
|
||||
<div class="card-body">
|
||||
|
|
|
|||
|
|
@ -5,248 +5,258 @@
|
|||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="text-light">Relatorio Geral</h1>
|
||||
<h1>Relatorios Gerais</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item active">Obrar Concluidas</li>
|
||||
<li class="breadcrumb-item active"><a href="{{ route('CreateUsers') }}">Relatorio Geral</a></li>
|
||||
<li class="breadcrumb-item active"><a href="{{ route('reportingDataClient') }}">Obras Concluidas</a></li>
|
||||
<li class="breadcrumb-item active"> Relatorios Gerais</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<fieldset class="content">
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<input type="hidden" id="projectId" value="{{ $receiveDataProject->company_projects_id }}">
|
||||
<input type="hidden" id="AmbitsIdString" value="{{ $AmbitsIdString }}">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-12">
|
||||
<input type="hidden" id="projectId" value="{{ $receiveDataProject->company_projects_id }}">
|
||||
<input type="hidden" id="AmbitsIdString" value="{{ $AmbitsIdString }}">
|
||||
|
||||
|
||||
<div class="card card-primary">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">{{ $receiveDataProject->company_project_description }}</h3>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<div class="card card-success collapsed-card">
|
||||
|
||||
<div class="card-header clickable">
|
||||
<h3 class="card-title">Relatório geral Ambito</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool collapse-button" data-card-widget="collapse"><i
|
||||
class="fas fa-plus"></i></button>
|
||||
</div>
|
||||
<div class="card card-primary">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">{{ $receiveDataProject->company_project_description }}</h3>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<table id="showReportingForAmbits" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Ambito</th>
|
||||
<th>Qtd.Equipmentos</th>
|
||||
<th>Visualizar</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div class="card card-success">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!--card card-success collapsed-card-->
|
||||
<div class="card-header clickable">
|
||||
<h3 class="card-title">Relatório geral Ambito</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool collapse-button"
|
||||
data-card-widget="collapse"><i class="fas fa-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card-primary collapsed-card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="card-header clickable">
|
||||
<h3 class="card-title">Relatório individual dos Equipamentos</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool collapse-button" data-card-widget="collapse"><i
|
||||
class="fas fa-plus"></i></button>
|
||||
<table id="showReportingForAmbits" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Ambito</th>
|
||||
<th>Qtd.Equipmentos</th>
|
||||
<th>Visualizar</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--card-header clickable-->
|
||||
<!--card card-success collapsed-card-->
|
||||
|
||||
<div class="card-body">
|
||||
<div class="card card-primary">
|
||||
|
||||
<div class="row text-center">
|
||||
|
||||
<div class="col-sm">
|
||||
<div class="form-group">
|
||||
<label>Fabricas </label>
|
||||
<select class="form-control" id="allUnitsProject" name="allUnitsProject">
|
||||
<option value='#' selected>Mostrar Todos</option>
|
||||
@foreach ($receiveUnitsOfProject as $unitsOfProject)
|
||||
<option value="{{ $unitsOfProject->unit_id }}">
|
||||
{{ $unitsOfProject->unit_name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<div class="card-header clickable">
|
||||
<h3 class="card-title">Relatório individual dos Equipamentos</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool collapse-button"
|
||||
data-card-widget="collapse"><i class="fas fa-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<!--card-header clickable-->
|
||||
|
||||
<div class="col-sm">
|
||||
<div class="form-group">
|
||||
<label>Ambito</label>
|
||||
<select class="form-control" id="AllAmbitsProject" name="AllAmbitsProject">
|
||||
<option value='#' selected>Mostrar Todos</option>
|
||||
@foreach ($receiveDataAmbitsProject as $ambitsProject)
|
||||
<option value="{{ $ambitsProject->ambits_id }}">
|
||||
{{ $ambitsProject->ambits_description }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row text-center">
|
||||
|
||||
<div class="col-sm">
|
||||
<div class="form-group">
|
||||
<label>Fabricas </label>
|
||||
<select class="form-control" id="allUnitsProject" name="allUnitsProject">
|
||||
<option value='#' selected>Mostrar Todos</option>
|
||||
@foreach ($receiveUnitsOfProject as $unitsOfProject)
|
||||
<option value="{{ $unitsOfProject->unit_id }}">
|
||||
{{ $unitsOfProject->unit_name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm">
|
||||
<div class="form-group">
|
||||
<label>Ambito</label>
|
||||
<select class="form-control" id="AllAmbitsProject" name="AllAmbitsProject">
|
||||
<option value='#' selected>Mostrar Todos</option>
|
||||
@foreach ($receiveDataAmbitsProject as $ambitsProject)
|
||||
<option value="{{ $ambitsProject->ambits_id }}">
|
||||
{{ $ambitsProject->ambits_description }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm">
|
||||
<div class="form-group">
|
||||
<label>Tipo de equipamento</label>
|
||||
<select class="form-control" id="typeEquipments" name="typeEquipments">
|
||||
<option value='#' selected>Mostrar Todos</option>
|
||||
@foreach ($receiveAllTypeEquipments as $allTypeEquipments)
|
||||
<option value="{{ $allTypeEquipments->equipment_type_id }}">
|
||||
{{ $allTypeEquipments->equipment_type_name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm">
|
||||
<div class="form-group">
|
||||
<label>Tipo de equipamento</label>
|
||||
<select class="form-control" id="typeEquipments" name="typeEquipments">
|
||||
<option value='#' selected>Mostrar Todos</option>
|
||||
@foreach ($receiveAllTypeEquipments as $allTypeEquipments)
|
||||
<option value="{{ $allTypeEquipments->equipment_type_id }}">
|
||||
{{ $allTypeEquipments->equipment_type_name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<!-- row text-center -->
|
||||
|
||||
<table id="showEquipmentsOfProject" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Fabrica</th>
|
||||
<th>Tag Number</th>
|
||||
<th>Tipo de Equipamento</th>
|
||||
<th>Ambito</th>
|
||||
<th>Visualizar</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<!--card-body-->
|
||||
|
||||
</div>
|
||||
<!-- row text-center -->
|
||||
|
||||
<table id="showEquipmentsOfProject" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Fabrica</th>
|
||||
<th>Tag Number</th>
|
||||
<th>Tipo de Equipamento</th>
|
||||
<th>Ambito</th>
|
||||
<th>Visualizar</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<!--card card-success collapsed-card-->
|
||||
|
||||
</div>
|
||||
<!--card-body-->
|
||||
|
||||
</div>
|
||||
<!--card card-success collapsed-card-->
|
||||
|
||||
</div>
|
||||
<!--card-body-->
|
||||
|
||||
</div>
|
||||
@endsection
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
|
||||
@section('scriptsTemplateAdmin')
|
||||
{{-- Script para abrir os cards sem precisar click no icones --}}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('.clickable').on('click', function(e) {
|
||||
// Verifica se o clique não foi no botão
|
||||
if (!$(e.target).is('.collapse-button') && !$(e.target).is('.collapse-button *')) {
|
||||
$(this).find('.collapse-button').trigger('click');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@section('scriptsTemplateAdmin')
|
||||
{{-- Script para abrir os cards sem precisar click no icones --}}
|
||||
|
||||
<script type="text/javascript">
|
||||
var dataTables;
|
||||
$(document).ready(function() {
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
dataTables = $('#showReportingForAmbits').DataTable({
|
||||
responsive: true,
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: {
|
||||
// Rota para obter os valores para o Yajra
|
||||
url: '{{ route('getDataAmbitsOfProject') }}',
|
||||
type: 'GET',
|
||||
data: function(d) {
|
||||
// Busca diretamente o valor de um input tipo Hidden para buscar e enviar o valor do id do project atual
|
||||
d.AmbitsIdString = $('#AmbitsIdString').val();
|
||||
d.projectId = $('#projectId').val();
|
||||
}
|
||||
},
|
||||
columns: [{
|
||||
data: 'ambits_description',
|
||||
name: 'ambits_description'
|
||||
},
|
||||
|
||||
$('.clickable').on('click', function(e) {
|
||||
// Verifica se o clique não foi no botão
|
||||
if (!$(e.target).is('.collapse-button') && !$(e.target).is('.collapse-button *')) {
|
||||
$(this).find('.collapse-button').trigger('click');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var dataTables;
|
||||
$(document).ready(function() {
|
||||
|
||||
{
|
||||
data: 'amountEquipment',
|
||||
name: 'amountEquipment'
|
||||
},
|
||||
{
|
||||
data: 'action',
|
||||
name: 'action',
|
||||
orderable: false,
|
||||
searchable: false
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
dataTables = $('#showReportingForAmbits').DataTable({
|
||||
responsive: true,
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: {
|
||||
// Rota para obter os valores para o Yajra
|
||||
url: '{{ route('getDataAmbitsOfProject') }}',
|
||||
type: 'GET',
|
||||
data: function(d) {
|
||||
// Busca diretamente o valor de um input tipo Hidden para buscar e enviar o valor do id do project atual
|
||||
d.AmbitsIdString = $('#AmbitsIdString').val();
|
||||
d.projectId = $('#projectId').val();
|
||||
}
|
||||
},
|
||||
columns: [{
|
||||
data: 'ambits_description',
|
||||
name: 'ambits_description'
|
||||
},
|
||||
|
||||
{
|
||||
data: 'amountEquipment',
|
||||
name: 'amountEquipment'
|
||||
},
|
||||
{
|
||||
data: 'action',
|
||||
name: 'action',
|
||||
orderable: false,
|
||||
searchable: false
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var dataTables;
|
||||
$(document).ready(function() {
|
||||
<script type="text/javascript">
|
||||
var dataTables;
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
dataTables = $('#showEquipmentsOfProject').DataTable({
|
||||
responsive: true,
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: {
|
||||
// Rota para obter os valores para o Yajra
|
||||
url: '{{ route('getDataEquipmentsOfProject') }}',
|
||||
type: 'GET',
|
||||
data: function(d) {
|
||||
// Envia as variaveis de acordo com as opcoes selecionadas para o DataTables
|
||||
d.allUnitsProject = $('#allUnitsProject').val();
|
||||
d.AllAmbitsProject = $('#AllAmbitsProject').val();
|
||||
d.typeEquipments = $('#typeEquipments').val();
|
||||
// Busca diretamente o valor de um input tipo Hidden para buscar e enviar o valor do id do project atual
|
||||
d.projectId = $('#projectId').val();
|
||||
}
|
||||
},
|
||||
columns: [{
|
||||
data: 'unit_id',
|
||||
name: 'unit_id'
|
||||
},
|
||||
{
|
||||
data: 'equipment_tag',
|
||||
name: 'equipment_tag'
|
||||
},
|
||||
{
|
||||
data: 'equipment_type_id',
|
||||
name: 'equipment_type_id'
|
||||
},
|
||||
{
|
||||
data: 'ambits_description',
|
||||
name: 'ambits_description'
|
||||
},
|
||||
{
|
||||
data: 'action',
|
||||
name: 'action',
|
||||
orderable: false,
|
||||
searchable: false
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
dataTables = $('#showEquipmentsOfProject').DataTable({
|
||||
responsive: true,
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: {
|
||||
// Rota para obter os valores para o Yajra
|
||||
url: '{{ route('getDataEquipmentsOfProject') }}',
|
||||
type: 'GET',
|
||||
data: function(d) {
|
||||
// Envia as variaveis de acordo com as opcoes selecionadas para o DataTables
|
||||
d.allUnitsProject = $('#allUnitsProject').val();
|
||||
d.AllAmbitsProject = $('#AllAmbitsProject').val();
|
||||
d.typeEquipments = $('#typeEquipments').val();
|
||||
// Busca diretamente o valor de um input tipo Hidden para buscar e enviar o valor do id do project atual
|
||||
d.projectId = $('#projectId').val();
|
||||
}
|
||||
},
|
||||
columns: [{
|
||||
data: 'unit_id',
|
||||
name: 'unit_id'
|
||||
},
|
||||
{
|
||||
data: 'equipment_tag',
|
||||
name: 'equipment_tag'
|
||||
},
|
||||
{
|
||||
data: 'equipment_type_id',
|
||||
name: 'equipment_type_id'
|
||||
},
|
||||
{
|
||||
data: 'ambits_description',
|
||||
name: 'ambits_description'
|
||||
},
|
||||
{
|
||||
data: 'action',
|
||||
name: 'action',
|
||||
orderable: false,
|
||||
searchable: false
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
//De acordo com os valores deste campos, como anteriormente ja sao enviados para a DataTables para fazer as filtragens, agora atualizamos a Tabela com base no filtros feitos
|
||||
$('#allUnitsProject,#AllAmbitsProject,#typeEquipments').on('change',
|
||||
function() {
|
||||
dataTables.ajax.reload();
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
//De acordo com os valores deste campos, como anteriormente ja sao enviados para a DataTables para fazer as filtragens, agora atualizamos a Tabela com base no filtros feitos
|
||||
$('#allUnitsProject,#AllAmbitsProject,#typeEquipments').on('change',
|
||||
function() {
|
||||
dataTables.ajax.reload();
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -0,0 +1,99 @@
|
|||
@extends('Templates/templateAdmin')
|
||||
|
||||
@section('Main-content')
|
||||
<input type="hidden" id="ambitId" value="{{ $ambitId }}">
|
||||
<input type="hidden" id="projectId" value="{{ $projectId }}">
|
||||
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1>Relatório geral Ambito</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item active"><a href="{{ route('reportingDataClient') }}">Obras Concluidas</a></li>
|
||||
<li class="breadcrumb-item active"><a href="{{ route('showDataDetailsProjectClient',['projectID' => $projectId]) }}">Relatorios Gerais</a></li>
|
||||
<li class="breadcrumb-item active">Relatório geral Ambito</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<fieldset class="content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="card card-primary">
|
||||
<div class="card-header">
|
||||
<div class="row">
|
||||
<div class="col-sm d-flex align-items-center">
|
||||
<h3 class="card-title ">{{ $dataAmbit->ambits_description }}</h3>
|
||||
</div>
|
||||
<div class="col-sm text-right">
|
||||
{{-- <a href="{{route('showReportingForAmbitsProjectPdf')}}><i class="fa-solid fa-file-pdf fa-2x"></i></a> --}}
|
||||
<a href="{{ route('showReportingForAmbitsProjectPdf', ['ambitId' => $ambitId, 'projectId' => $projectId]) }}"><i class="fa-solid fa-file-pdf fa-2x"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--./card-header-->
|
||||
<div class="card-body">
|
||||
|
||||
<table id="equipments" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nº ISPT</th>
|
||||
<th>Unidade</th>
|
||||
<th>Tag Nº</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<!--./card-body-->
|
||||
</div>
|
||||
<!--./card card-primary-->
|
||||
</div>
|
||||
</fieldset>
|
||||
@endsection
|
||||
|
||||
@section('scriptsTemplateAdmin')
|
||||
<script>
|
||||
var projectIdValue = document.getElementById('projectId').value;
|
||||
console.log(projectIdValue);
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var dataTables;
|
||||
$(document).ready(function() {
|
||||
|
||||
dataTables = $('#equipments').DataTable({
|
||||
responsive: true,
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: {
|
||||
url: '{{ route('getEquipmentsOfAmbit') }}', // Certifique-se de que esta rota esteja correta.
|
||||
type: 'GET',
|
||||
data: function(d) {
|
||||
// Busca diretamente o valor de um input tipo Hidden para buscar e enviar o valor do id do project atual
|
||||
d.ambitId = $('#ambitId').val();
|
||||
d.projectId = $('#projectId').val();
|
||||
}
|
||||
},
|
||||
columns: [{
|
||||
data: 'ispt_number',
|
||||
name: 'ispt_number'
|
||||
},
|
||||
{
|
||||
data: 'unit_id',
|
||||
name: 'unit_id'
|
||||
},
|
||||
{
|
||||
data: 'equipment_tag',
|
||||
name: 'equipment_tag'
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
37
resources/views/vendor/datatables/print.blade.php
vendored
Normal file
37
resources/views/vendor/datatables/print.blade.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Print Table</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name=description content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
|
||||
<style>
|
||||
body {margin: 20px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="table table-bordered table-condensed table-striped">
|
||||
@foreach($data as $row)
|
||||
@if ($loop->first)
|
||||
<tr>
|
||||
@foreach($row as $key => $value)
|
||||
<th>{!! $key !!}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
@foreach($row as $key => $value)
|
||||
@if(is_string($value) || is_numeric($value))
|
||||
<td>{!! $value !!}</td>
|
||||
@else
|
||||
<td></td>
|
||||
@endif
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use App\DataTables\UsersDataTable;
|
||||
use App\Http\Controllers\ClientController;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
|
@ -46,20 +47,30 @@
|
|||
Route::get('manageAssets/{equipmentID}', [ProjectoDatacontroller::class, 'test22'])->name('test22');
|
||||
|
||||
|
||||
|
||||
Route::get('getDataEquipment', [ExecutionProjectController::class, 'getDataEquipment'])->name('getDataEquipment');
|
||||
Route::get('getDataEquipmentClient', [ExecutionProjectController::class, 'getDataEquipmentClient'])->name('getDataEquipmentClient');
|
||||
|
||||
|
||||
Route::get('showDataDetailsProjectClient/{projectID?}', [ClientController::class, 'showDataDetailsProjectClient'])->name('showDataDetailsProjectClient');
|
||||
Route::get('getDataProjectsClient', [ClientController::class,'getDataProjectsClient'])->name('getDataProjectsClient'); //OK
|
||||
Route::get('getDataEquipmentsOfProject',[ClientController::class,'getDataEquipmentsOfProject'])->name('getDataEquipmentsOfProject');//ok
|
||||
Route::get('showReportingEquipmentProject/{dataEquipment}', [ClientController::class,'showReportingEquipmentProject'])->name('showReportingEquipmentProject');//oK
|
||||
Route::get('showReportingForAmbitsProject/{dataAmbit}/{projectId}', [ClientController::class,'showReportingForAmbitsProject'])->name('showReportingForAmbitsProject');//ok
|
||||
Route::get('getDataAmbitsOfProject', [ClientController::class, 'getDataAmbitsOfProject'])->name('getDataAmbitsOfProject');//ok
|
||||
Route::get('getDataProjectsClient', [ClientController::class, 'getDataProjectsClient'])->name('getDataProjectsClient');
|
||||
Route::get('showReportingEquipmentProject/{dataEquipment}', [ClientController::class, 'showReportingEquipmentProject'])->name('showReportingEquipmentProject'); //oK
|
||||
|
||||
Route::get('getDataAllEquipmentsForAmbitOfProject', [ClientController::class,'getDataAllEquipmentsForAmbitOfProject'])->name('getDataAllEquipmentsForAmbitOfProject');
|
||||
Route::get('showReportingForAmbitsProjectPdf/{ambitId}/{projectId}', [ClientController::class, 'showReportingForAmbitsProjectPdf'])->name('showReportingForAmbitsProjectPdf'); //ok
|
||||
|
||||
Route::get('getDataAllEquipmentsForAmbitOfProject', [ClientController::class, 'getDataAllEquipmentsForAmbitOfProject'])->name('getDataAllEquipmentsForAmbitOfProject');
|
||||
// Route::get('test/{id}',[ExecutionProjectController::class, 'test11'])->name('test11');
|
||||
|
||||
// Route::get('getEquipment', [ClientController::class, 'getEquipment'])->name('getEquipment');
|
||||
|
||||
// Route::get('getEquipmentsOfAmbit', [ClientController::class, 'getEquipmentsOfAmbit'])->name('getEquipmentsOfAmbit');
|
||||
|
||||
|
||||
|
||||
// Route::get('getEquipment', [UsersDataTable::class,'getEquipment'])->name('getEquipment');
|
||||
// Route::get('getEquipment', [UsersDataTable::class, 'html'])->name('getEquipment');
|
||||
|
||||
|
||||
|
||||
Route::post('language/switch', [LanguageController::class, 'switchLanguage'])->name('language.switch');
|
||||
|
||||
// Esta rota so pode aceder quem tiver o link atravez do email
|
||||
|
|
@ -105,10 +116,28 @@
|
|||
});
|
||||
|
||||
Route::middleware(['checkUserType:testClient'])->group(function () {
|
||||
// Dashboard
|
||||
Route::get('dashboardClient', [ClientController::class, 'receiveProjectsClient'])->name('dashboardClient');
|
||||
// Relatorios
|
||||
Route::get('reportingDataClient', [ClientController::class, 'reportingDataClient'])->name('reportingDataClient');
|
||||
//Api
|
||||
Route::get('/api/receiveMonths/{yearsProjects}', [ClientController::class, 'receiveMonths']);
|
||||
Route::get('/api/receiveDays/{yearProjects}/{monthProjects}', [ClientController::class, 'receiveDays']);
|
||||
|
||||
// Equipamentos do Cliente
|
||||
Route::get('manageAssetsClient', [ClientController::class, 'receiveManageAssetsClient'])->name('manageAssetsClient');
|
||||
Route::get('reportingDataClient', [ClientController::class,'reportingDataClient'])->name('reportingDataClient');
|
||||
|
||||
//Relatorios Obras Concluidas
|
||||
Route::get('showDataDetailsProjectClient/{projectID?}', [ClientController::class, 'showDataDetailsProjectClient'])->name('showDataDetailsProjectClient');
|
||||
//Api
|
||||
Route::get('getDataAmbitsOfProject', [ClientController::class, 'getDataAmbitsOfProject'])->name('getDataAmbitsOfProject');
|
||||
Route::get('getDataEquipmentsOfProject', [ClientController::class, 'getDataEquipmentsOfProject'])->name('getDataEquipmentsOfProject');
|
||||
|
||||
// Relatorio por Ambito de uma Determinada Obra.
|
||||
Route::get('showReportingForAmbitsProject/{ambitId}/{projectId}', [ClientController::class, 'showReportingForAmbitsProject'])->name('showReportingForAmbitsProject');
|
||||
//Api
|
||||
Route::get('getEquipmentsOfAmbit', [ClientController::class, 'getEquipmentsOfAmbit'])->name('getEquipmentsOfAmbit');
|
||||
|
||||
});
|
||||
|
||||
/*
|
||||
|
|
@ -239,10 +268,7 @@
|
|||
|
||||
|
||||
|
||||
Route::get('/api/receiveMonths/{yearsProjects}', [ClientController::class,'receiveMonths']);
|
||||
// Route::get('/api/receiveDays/{monthsProjects}', [ClientController::class,'receiveDays']);
|
||||
|
||||
Route::get('/api/receiveDays/{yearProjects}/{monthProjects}', [ClientController::class, 'receiveDays']);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
72
vendor/composer/autoload_classmap.php
vendored
72
vendor/composer/autoload_classmap.php
vendored
|
|
@ -16,7 +16,6 @@
|
|||
'App\\Http\\Controllers\\Auth\\PasswordResetLinkController' => $baseDir . '/app/Http/Controllers/Auth/PasswordResetLinkController.php',
|
||||
'App\\Http\\Controllers\\Auth\\ResetPasswordController' => $baseDir . '/app/Http/Controllers/Auth/ResetPasswordController.php',
|
||||
'App\\Http\\Controllers\\ClientController' => $baseDir . '/app/Http/Controllers/ClientController.php',
|
||||
'App\\Http\\Controllers\\ClienteController' => $baseDir . '/app/Http/Controllers/ClienteController.php',
|
||||
'App\\Http\\Controllers\\Controller' => $baseDir . '/app/Http/Controllers/Controller.php',
|
||||
'App\\Http\\Controllers\\CreateProjectController' => $baseDir . '/app/Http/Controllers/CreateProjectController.php',
|
||||
'App\\Http\\Controllers\\CustomRegistrationController' => $baseDir . '/app/Http/Controllers/CustomRegistrationController.php',
|
||||
|
|
@ -7246,18 +7245,89 @@
|
|||
'Whoops\\Util\\SystemFacade' => $vendorDir . '/filp/whoops/src/Whoops/Util/SystemFacade.php',
|
||||
'Whoops\\Util\\TemplateHelper' => $vendorDir . '/filp/whoops/src/Whoops/Util/TemplateHelper.php',
|
||||
'Yajra\\DataTables\\ApiResourceDataTable' => $vendorDir . '/yajra/laravel-datatables-oracle/src/ApiResourceDataTable.php',
|
||||
'Yajra\\DataTables\\ButtonsServiceProvider' => $vendorDir . '/yajra/laravel-datatables-buttons/src/ButtonsServiceProvider.php',
|
||||
'Yajra\\DataTables\\CollectionDataTable' => $vendorDir . '/yajra/laravel-datatables-oracle/src/CollectionDataTable.php',
|
||||
'Yajra\\DataTables\\Contracts\\DataTable' => $vendorDir . '/yajra/laravel-datatables-oracle/src/Contracts/DataTable.php',
|
||||
'Yajra\\DataTables\\Contracts\\DataTableButtons' => $vendorDir . '/yajra/laravel-datatables-buttons/src/Contracts/DataTableButtons.php',
|
||||
'Yajra\\DataTables\\Contracts\\DataTableHtmlBuilder' => $vendorDir . '/yajra/laravel-datatables-buttons/src/Contracts/DataTableHtmlBuilder.php',
|
||||
'Yajra\\DataTables\\Contracts\\DataTableScope' => $vendorDir . '/yajra/laravel-datatables-buttons/src/Contracts/DataTableScope.php',
|
||||
'Yajra\\DataTables\\Contracts\\Formatter' => $vendorDir . '/yajra/laravel-datatables-oracle/src/Contracts/Formatter.php',
|
||||
'Yajra\\DataTables\\DataTableAbstract' => $vendorDir . '/yajra/laravel-datatables-oracle/src/DataTableAbstract.php',
|
||||
'Yajra\\DataTables\\DataTables' => $vendorDir . '/yajra/laravel-datatables-oracle/src/DataTables.php',
|
||||
'Yajra\\DataTables\\DataTablesServiceProvider' => $vendorDir . '/yajra/laravel-datatables-oracle/src/DataTablesServiceProvider.php',
|
||||
'Yajra\\DataTables\\EloquentDataTable' => $vendorDir . '/yajra/laravel-datatables-oracle/src/EloquentDataTable.php',
|
||||
'Yajra\\DataTables\\Exceptions\\Exception' => $vendorDir . '/yajra/laravel-datatables-oracle/src/Exceptions/Exception.php',
|
||||
'Yajra\\DataTables\\Exports\\DataTablesCollectionExport' => $vendorDir . '/yajra/laravel-datatables-buttons/src/Exports/DataTablesCollectionExport.php',
|
||||
'Yajra\\DataTables\\Facades\\DataTables' => $vendorDir . '/yajra/laravel-datatables-oracle/src/Facades/DataTables.php',
|
||||
'Yajra\\DataTables\\Generators\\DataTablesHtmlCommand' => $vendorDir . '/yajra/laravel-datatables-buttons/src/Generators/DataTablesHtmlCommand.php',
|
||||
'Yajra\\DataTables\\Generators\\DataTablesMakeCommand' => $vendorDir . '/yajra/laravel-datatables-buttons/src/Generators/DataTablesMakeCommand.php',
|
||||
'Yajra\\DataTables\\Generators\\DataTablesScopeCommand' => $vendorDir . '/yajra/laravel-datatables-buttons/src/Generators/DataTablesScopeCommand.php',
|
||||
'Yajra\\DataTables\\HtmlServiceProvider' => $vendorDir . '/yajra/laravel-datatables-html/src/HtmlServiceProvider.php',
|
||||
'Yajra\\DataTables\\Html\\Builder' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Builder.php',
|
||||
'Yajra\\DataTables\\Html\\Button' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Button.php',
|
||||
'Yajra\\DataTables\\Html\\Column' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Column.php',
|
||||
'Yajra\\DataTables\\Html\\ColumnDefinition' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/ColumnDefinition.php',
|
||||
'Yajra\\DataTables\\Html\\ColumnDefinitions' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/ColumnDefinitions.php',
|
||||
'Yajra\\DataTables\\Html\\Columns\\Action' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Columns/Action.php',
|
||||
'Yajra\\DataTables\\Html\\Columns\\Checkbox' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Columns/Checkbox.php',
|
||||
'Yajra\\DataTables\\Html\\Columns\\Index' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Columns/Index.php',
|
||||
'Yajra\\DataTables\\Html\\DataTableHtml' => $vendorDir . '/yajra/laravel-datatables-buttons/src/Html/DataTableHtml.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Editor' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Editor.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\BelongsTo' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/BelongsTo.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Boolean' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Boolean.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Checkbox' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Checkbox.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Date' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Date.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\DateTime' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/DateTime.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Field' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Field.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\File' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/File.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Hidden' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Hidden.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Image' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Image.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Number' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Number.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Options' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Options.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Password' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Password.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Radio' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Radio.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\ReadOnlyField' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/ReadOnlyField.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Select' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Select.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Select2' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Select2.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Text' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Text.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\TextArea' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/TextArea.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Time' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Time.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\FormOptions' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/FormOptions.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\HasEvents' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Editor/HasEvents.php',
|
||||
'Yajra\\DataTables\\Html\\HasAuthorizations' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/HasAuthorizations.php',
|
||||
'Yajra\\DataTables\\Html\\HasEditor' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/HasEditor.php',
|
||||
'Yajra\\DataTables\\Html\\HasOptions' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/HasOptions.php',
|
||||
'Yajra\\DataTables\\Html\\HasTable' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/HasTable.php',
|
||||
'Yajra\\DataTables\\Html\\HtmlBuilder' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/HtmlBuilder.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\HasAjax' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/HasAjax.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\HasCallbacks' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/HasCallbacks.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\HasColumns' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/HasColumns.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\HasFeatures' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/HasFeatures.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\HasInternationalisation' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/HasInternationalisation.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Languages\\Aria' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/Languages/Aria.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Languages\\AutoFill' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/Languages/AutoFill.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Languages\\Paginate' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/Languages/Paginate.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Languages\\Select' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/Languages/Select.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\AutoFill' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/AutoFill.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\Buttons' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/Buttons.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\ColReorder' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/ColReorder.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\FixedColumns' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/FixedColumns.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\FixedHeader' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/FixedHeader.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\KeyTable' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/KeyTable.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\Responsive' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/Responsive.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\RowGroup' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/RowGroup.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\RowReorder' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/RowReorder.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\Scroller' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/Scroller.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\SearchPanes' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/SearchPanes.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\Select' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/Select.php',
|
||||
'Yajra\\DataTables\\Html\\Parameters' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/Parameters.php',
|
||||
'Yajra\\DataTables\\Html\\SearchPane' => $vendorDir . '/yajra/laravel-datatables-html/src/Html/SearchPane.php',
|
||||
'Yajra\\DataTables\\Processors\\DataProcessor' => $vendorDir . '/yajra/laravel-datatables-oracle/src/Processors/DataProcessor.php',
|
||||
'Yajra\\DataTables\\Processors\\RowProcessor' => $vendorDir . '/yajra/laravel-datatables-oracle/src/Processors/RowProcessor.php',
|
||||
'Yajra\\DataTables\\QueryDataTable' => $vendorDir . '/yajra/laravel-datatables-oracle/src/QueryDataTable.php',
|
||||
'Yajra\\DataTables\\Services\\DataTable' => $vendorDir . '/yajra/laravel-datatables-buttons/src/Services/DataTable.php',
|
||||
'Yajra\\DataTables\\Services\\DataTablesExportHandler' => $vendorDir . '/yajra/laravel-datatables-buttons/src/Services/DataTablesExportHandler.php',
|
||||
'Yajra\\DataTables\\Transformers\\DataArrayTransformer' => $vendorDir . '/yajra/laravel-datatables-buttons/src/Transformers/DataArrayTransformer.php',
|
||||
'Yajra\\DataTables\\Utilities\\Config' => $vendorDir . '/yajra/laravel-datatables-oracle/src/Utilities/Config.php',
|
||||
'Yajra\\DataTables\\Utilities\\Helper' => $vendorDir . '/yajra/laravel-datatables-oracle/src/Utilities/Helper.php',
|
||||
'Yajra\\DataTables\\Utilities\\Request' => $vendorDir . '/yajra/laravel-datatables-oracle/src/Utilities/Request.php',
|
||||
|
|
|
|||
2
vendor/composer/autoload_files.php
vendored
2
vendor/composer/autoload_files.php
vendored
|
|
@ -17,6 +17,7 @@
|
|||
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
|
||||
'3bd81c9b8fcc150b69d8b63b4d2ccf23' => $vendorDir . '/spatie/flare-client-php/src/helpers.php',
|
||||
'0b47d6d4a00ca9112ba3953b49e7c9a4' => $vendorDir . '/yajra/laravel-datatables-oracle/src/helper.php',
|
||||
'35a6ad97d21e794e7e22a17d806652e4' => $vendorDir . '/nunomaduro/termwind/src/Functions.php',
|
||||
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
|
||||
'09f6b20656683369174dd6fa83b7e5fb' => $vendorDir . '/symfony/polyfill-uuid/bootstrap.php',
|
||||
|
|
@ -35,5 +36,4 @@
|
|||
'a1cfe24d14977df6878b9bf804af2d1c' => $vendorDir . '/nunomaduro/collision/src/Adapters/Phpunit/Autoload.php',
|
||||
'ec07570ca5a812141189b1fa81503674' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
|
||||
'320163ac6b93aebe3dc25b60a0533d56' => $vendorDir . '/spatie/laravel-ignition/src/helpers.php',
|
||||
'0b47d6d4a00ca9112ba3953b49e7c9a4' => $vendorDir . '/yajra/laravel-datatables-oracle/src/helper.php',
|
||||
);
|
||||
|
|
|
|||
2
vendor/composer/autoload_psr4.php
vendored
2
vendor/composer/autoload_psr4.php
vendored
|
|
@ -8,7 +8,7 @@
|
|||
return array(
|
||||
'voku\\' => array($vendorDir . '/voku/portable-ascii/src/voku'),
|
||||
'ZipStream\\' => array($vendorDir . '/maennchen/zipstream-php/src'),
|
||||
'Yajra\\DataTables\\' => array($vendorDir . '/yajra/laravel-datatables-oracle/src'),
|
||||
'Yajra\\DataTables\\' => array($vendorDir . '/yajra/laravel-datatables-oracle/src', $vendorDir . '/yajra/laravel-datatables-buttons/src', $vendorDir . '/yajra/laravel-datatables-html/src'),
|
||||
'Whoops\\' => array($vendorDir . '/filp/whoops/src/Whoops'),
|
||||
'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'),
|
||||
'TijsVerkoyen\\CssToInlineStyles\\' => array($vendorDir . '/tijsverkoyen/css-to-inline-styles/src'),
|
||||
|
|
|
|||
76
vendor/composer/autoload_static.php
vendored
76
vendor/composer/autoload_static.php
vendored
|
|
@ -18,6 +18,7 @@ class ComposerStaticInit4de2290df2a8c5142f72130885c7079d
|
|||
'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
'3bd81c9b8fcc150b69d8b63b4d2ccf23' => __DIR__ . '/..' . '/spatie/flare-client-php/src/helpers.php',
|
||||
'0b47d6d4a00ca9112ba3953b49e7c9a4' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/helper.php',
|
||||
'35a6ad97d21e794e7e22a17d806652e4' => __DIR__ . '/..' . '/nunomaduro/termwind/src/Functions.php',
|
||||
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
|
||||
'09f6b20656683369174dd6fa83b7e5fb' => __DIR__ . '/..' . '/symfony/polyfill-uuid/bootstrap.php',
|
||||
|
|
@ -36,7 +37,6 @@ class ComposerStaticInit4de2290df2a8c5142f72130885c7079d
|
|||
'a1cfe24d14977df6878b9bf804af2d1c' => __DIR__ . '/..' . '/nunomaduro/collision/src/Adapters/Phpunit/Autoload.php',
|
||||
'ec07570ca5a812141189b1fa81503674' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
|
||||
'320163ac6b93aebe3dc25b60a0533d56' => __DIR__ . '/..' . '/spatie/laravel-ignition/src/helpers.php',
|
||||
'0b47d6d4a00ca9112ba3953b49e7c9a4' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/helper.php',
|
||||
);
|
||||
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
|
|
@ -211,6 +211,8 @@ class ComposerStaticInit4de2290df2a8c5142f72130885c7079d
|
|||
'Yajra\\DataTables\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src',
|
||||
1 => __DIR__ . '/..' . '/yajra/laravel-datatables-buttons/src',
|
||||
2 => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src',
|
||||
),
|
||||
'Whoops\\' =>
|
||||
array (
|
||||
|
|
@ -636,7 +638,6 @@ class ComposerStaticInit4de2290df2a8c5142f72130885c7079d
|
|||
'App\\Http\\Controllers\\Auth\\PasswordResetLinkController' => __DIR__ . '/../..' . '/app/Http/Controllers/Auth/PasswordResetLinkController.php',
|
||||
'App\\Http\\Controllers\\Auth\\ResetPasswordController' => __DIR__ . '/../..' . '/app/Http/Controllers/Auth/ResetPasswordController.php',
|
||||
'App\\Http\\Controllers\\ClientController' => __DIR__ . '/../..' . '/app/Http/Controllers/ClientController.php',
|
||||
'App\\Http\\Controllers\\ClienteController' => __DIR__ . '/../..' . '/app/Http/Controllers/ClienteController.php',
|
||||
'App\\Http\\Controllers\\Controller' => __DIR__ . '/../..' . '/app/Http/Controllers/Controller.php',
|
||||
'App\\Http\\Controllers\\CreateProjectController' => __DIR__ . '/../..' . '/app/Http/Controllers/CreateProjectController.php',
|
||||
'App\\Http\\Controllers\\CustomRegistrationController' => __DIR__ . '/../..' . '/app/Http/Controllers/CustomRegistrationController.php',
|
||||
|
|
@ -7866,18 +7867,89 @@ class ComposerStaticInit4de2290df2a8c5142f72130885c7079d
|
|||
'Whoops\\Util\\SystemFacade' => __DIR__ . '/..' . '/filp/whoops/src/Whoops/Util/SystemFacade.php',
|
||||
'Whoops\\Util\\TemplateHelper' => __DIR__ . '/..' . '/filp/whoops/src/Whoops/Util/TemplateHelper.php',
|
||||
'Yajra\\DataTables\\ApiResourceDataTable' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/ApiResourceDataTable.php',
|
||||
'Yajra\\DataTables\\ButtonsServiceProvider' => __DIR__ . '/..' . '/yajra/laravel-datatables-buttons/src/ButtonsServiceProvider.php',
|
||||
'Yajra\\DataTables\\CollectionDataTable' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/CollectionDataTable.php',
|
||||
'Yajra\\DataTables\\Contracts\\DataTable' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/Contracts/DataTable.php',
|
||||
'Yajra\\DataTables\\Contracts\\DataTableButtons' => __DIR__ . '/..' . '/yajra/laravel-datatables-buttons/src/Contracts/DataTableButtons.php',
|
||||
'Yajra\\DataTables\\Contracts\\DataTableHtmlBuilder' => __DIR__ . '/..' . '/yajra/laravel-datatables-buttons/src/Contracts/DataTableHtmlBuilder.php',
|
||||
'Yajra\\DataTables\\Contracts\\DataTableScope' => __DIR__ . '/..' . '/yajra/laravel-datatables-buttons/src/Contracts/DataTableScope.php',
|
||||
'Yajra\\DataTables\\Contracts\\Formatter' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/Contracts/Formatter.php',
|
||||
'Yajra\\DataTables\\DataTableAbstract' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/DataTableAbstract.php',
|
||||
'Yajra\\DataTables\\DataTables' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/DataTables.php',
|
||||
'Yajra\\DataTables\\DataTablesServiceProvider' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/DataTablesServiceProvider.php',
|
||||
'Yajra\\DataTables\\EloquentDataTable' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/EloquentDataTable.php',
|
||||
'Yajra\\DataTables\\Exceptions\\Exception' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/Exceptions/Exception.php',
|
||||
'Yajra\\DataTables\\Exports\\DataTablesCollectionExport' => __DIR__ . '/..' . '/yajra/laravel-datatables-buttons/src/Exports/DataTablesCollectionExport.php',
|
||||
'Yajra\\DataTables\\Facades\\DataTables' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/Facades/DataTables.php',
|
||||
'Yajra\\DataTables\\Generators\\DataTablesHtmlCommand' => __DIR__ . '/..' . '/yajra/laravel-datatables-buttons/src/Generators/DataTablesHtmlCommand.php',
|
||||
'Yajra\\DataTables\\Generators\\DataTablesMakeCommand' => __DIR__ . '/..' . '/yajra/laravel-datatables-buttons/src/Generators/DataTablesMakeCommand.php',
|
||||
'Yajra\\DataTables\\Generators\\DataTablesScopeCommand' => __DIR__ . '/..' . '/yajra/laravel-datatables-buttons/src/Generators/DataTablesScopeCommand.php',
|
||||
'Yajra\\DataTables\\HtmlServiceProvider' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/HtmlServiceProvider.php',
|
||||
'Yajra\\DataTables\\Html\\Builder' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Builder.php',
|
||||
'Yajra\\DataTables\\Html\\Button' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Button.php',
|
||||
'Yajra\\DataTables\\Html\\Column' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Column.php',
|
||||
'Yajra\\DataTables\\Html\\ColumnDefinition' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/ColumnDefinition.php',
|
||||
'Yajra\\DataTables\\Html\\ColumnDefinitions' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/ColumnDefinitions.php',
|
||||
'Yajra\\DataTables\\Html\\Columns\\Action' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Columns/Action.php',
|
||||
'Yajra\\DataTables\\Html\\Columns\\Checkbox' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Columns/Checkbox.php',
|
||||
'Yajra\\DataTables\\Html\\Columns\\Index' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Columns/Index.php',
|
||||
'Yajra\\DataTables\\Html\\DataTableHtml' => __DIR__ . '/..' . '/yajra/laravel-datatables-buttons/src/Html/DataTableHtml.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Editor' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Editor.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\BelongsTo' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/BelongsTo.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Boolean' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Boolean.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Checkbox' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Checkbox.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Date' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Date.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\DateTime' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/DateTime.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Field' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Field.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\File' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/File.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Hidden' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Hidden.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Image' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Image.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Number' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Number.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Options' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Options.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Password' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Password.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Radio' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Radio.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\ReadOnlyField' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/ReadOnlyField.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Select' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Select.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Select2' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Select2.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Text' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Text.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\TextArea' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/TextArea.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\Fields\\Time' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/Fields/Time.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\FormOptions' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/FormOptions.php',
|
||||
'Yajra\\DataTables\\Html\\Editor\\HasEvents' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Editor/HasEvents.php',
|
||||
'Yajra\\DataTables\\Html\\HasAuthorizations' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/HasAuthorizations.php',
|
||||
'Yajra\\DataTables\\Html\\HasEditor' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/HasEditor.php',
|
||||
'Yajra\\DataTables\\Html\\HasOptions' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/HasOptions.php',
|
||||
'Yajra\\DataTables\\Html\\HasTable' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/HasTable.php',
|
||||
'Yajra\\DataTables\\Html\\HtmlBuilder' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/HtmlBuilder.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\HasAjax' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/HasAjax.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\HasCallbacks' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/HasCallbacks.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\HasColumns' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/HasColumns.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\HasFeatures' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/HasFeatures.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\HasInternationalisation' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/HasInternationalisation.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Languages\\Aria' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/Languages/Aria.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Languages\\AutoFill' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/Languages/AutoFill.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Languages\\Paginate' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/Languages/Paginate.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Languages\\Select' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/Languages/Select.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\AutoFill' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/AutoFill.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\Buttons' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/Buttons.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\ColReorder' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/ColReorder.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\FixedColumns' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/FixedColumns.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\FixedHeader' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/FixedHeader.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\KeyTable' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/KeyTable.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\Responsive' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/Responsive.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\RowGroup' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/RowGroup.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\RowReorder' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/RowReorder.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\Scroller' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/Scroller.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\SearchPanes' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/SearchPanes.php',
|
||||
'Yajra\\DataTables\\Html\\Options\\Plugins\\Select' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Options/Plugins/Select.php',
|
||||
'Yajra\\DataTables\\Html\\Parameters' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/Parameters.php',
|
||||
'Yajra\\DataTables\\Html\\SearchPane' => __DIR__ . '/..' . '/yajra/laravel-datatables-html/src/Html/SearchPane.php',
|
||||
'Yajra\\DataTables\\Processors\\DataProcessor' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/Processors/DataProcessor.php',
|
||||
'Yajra\\DataTables\\Processors\\RowProcessor' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/Processors/RowProcessor.php',
|
||||
'Yajra\\DataTables\\QueryDataTable' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/QueryDataTable.php',
|
||||
'Yajra\\DataTables\\Services\\DataTable' => __DIR__ . '/..' . '/yajra/laravel-datatables-buttons/src/Services/DataTable.php',
|
||||
'Yajra\\DataTables\\Services\\DataTablesExportHandler' => __DIR__ . '/..' . '/yajra/laravel-datatables-buttons/src/Services/DataTablesExportHandler.php',
|
||||
'Yajra\\DataTables\\Transformers\\DataArrayTransformer' => __DIR__ . '/..' . '/yajra/laravel-datatables-buttons/src/Transformers/DataArrayTransformer.php',
|
||||
'Yajra\\DataTables\\Utilities\\Config' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/Utilities/Config.php',
|
||||
'Yajra\\DataTables\\Utilities\\Helper' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/Utilities/Helper.php',
|
||||
'Yajra\\DataTables\\Utilities\\Request' => __DIR__ . '/..' . '/yajra/laravel-datatables-oracle/src/Utilities/Request.php',
|
||||
|
|
|
|||
162
vendor/composer/installed.json
vendored
162
vendor/composer/installed.json
vendored
|
|
@ -9550,6 +9550,168 @@
|
|||
},
|
||||
"install-path": "../webmozart/assert"
|
||||
},
|
||||
{
|
||||
"name": "yajra/laravel-datatables-buttons",
|
||||
"version": "v10.0.8",
|
||||
"version_normalized": "10.0.8.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/yajra/laravel-datatables-buttons.git",
|
||||
"reference": "cdd2b907f892cba4b840b4ed14f73bc73086d0cf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/yajra/laravel-datatables-buttons/zipball/cdd2b907f892cba4b840b4ed14f73bc73086d0cf",
|
||||
"reference": "cdd2b907f892cba4b840b4ed14f73bc73086d0cf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/console": "^10",
|
||||
"php": "^8.1",
|
||||
"yajra/laravel-datatables-html": "^10",
|
||||
"yajra/laravel-datatables-oracle": "^10"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-snappy": "^1.0.1",
|
||||
"maatwebsite/excel": "^3.1.46",
|
||||
"nunomaduro/larastan": "^2.4",
|
||||
"orchestra/testbench": "^8",
|
||||
"rap2hpoutre/fast-excel": "^5.1"
|
||||
},
|
||||
"suggest": {
|
||||
"barryvdh/laravel-snappy": "Allows exporting of dataTable to PDF using the print view.",
|
||||
"dompdf/dompdf": "Allows exporting of dataTable to PDF using the DomPDF.",
|
||||
"maatwebsite/excel": "Exporting of dataTables (excel, csv and PDF) using maatwebsite package.",
|
||||
"rap2hpoutre/fast-excel": "Faster exporting of dataTables using fast-excel package.",
|
||||
"yajra/laravel-datatables-export": "Exporting of dataTables (excel, csv and PDF) via livewire and queue worker."
|
||||
},
|
||||
"time": "2023-11-15T06:05:11+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "10.0-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Yajra\\DataTables\\ButtonsServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Yajra\\DataTables\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Arjay Angeles",
|
||||
"email": "aqangeles@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Laravel DataTables Buttons Plugin.",
|
||||
"keywords": [
|
||||
"buttons",
|
||||
"datatables",
|
||||
"jquery",
|
||||
"laravel"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/yajra/laravel-datatables-buttons/issues",
|
||||
"source": "https://github.com/yajra/laravel-datatables-buttons/tree/v10.0.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sponsors/yajra",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"install-path": "../yajra/laravel-datatables-buttons"
|
||||
},
|
||||
{
|
||||
"name": "yajra/laravel-datatables-html",
|
||||
"version": "v10.12.0",
|
||||
"version_normalized": "10.12.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/yajra/laravel-datatables-html.git",
|
||||
"reference": "1c0fc1ff2026457ff29ab1a6a3433a44d59b251d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/yajra/laravel-datatables-html/zipball/1c0fc1ff2026457ff29ab1a6a3433a44d59b251d",
|
||||
"reference": "1c0fc1ff2026457ff29ab1a6a3433a44d59b251d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"php": "^8.1",
|
||||
"yajra/laravel-datatables-oracle": "^10.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"nunomaduro/larastan": "^2.4",
|
||||
"orchestra/testbench": "^7.21"
|
||||
},
|
||||
"time": "2023-12-15T04:41:00+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "10.0-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Yajra\\DataTables\\HtmlServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Yajra\\DataTables\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Arjay Angeles",
|
||||
"email": "aqangeles@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Laravel DataTables HTML builder plugin for Laravel 5.4+.",
|
||||
"keywords": [
|
||||
"JS",
|
||||
"datatables",
|
||||
"html",
|
||||
"jquery",
|
||||
"laravel"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/yajra/laravel-datatables-html/issues",
|
||||
"source": "https://github.com/yajra/laravel-datatables-html/tree/v10.12.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://www.paypal.me/yajra",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/yajra",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://www.patreon.com/yajra",
|
||||
"type": "patreon"
|
||||
}
|
||||
],
|
||||
"install-path": "../yajra/laravel-datatables-html"
|
||||
},
|
||||
{
|
||||
"name": "yajra/laravel-datatables-oracle",
|
||||
"version": "v10.6.0",
|
||||
|
|
|
|||
22
vendor/composer/installed.php
vendored
22
vendor/composer/installed.php
vendored
|
|
@ -3,7 +3,7 @@
|
|||
'name' => 'laravel/laravel',
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'reference' => 'ff6e6a91ad76aee6fc8a84554605b54db7d43c25',
|
||||
'reference' => 'b29188b29ea6c7e18c4a9303a174fb6d2abc6b64',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
|
@ -427,7 +427,7 @@
|
|||
'laravel/laravel' => array(
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'reference' => 'ff6e6a91ad76aee6fc8a84554605b54db7d43c25',
|
||||
'reference' => 'b29188b29ea6c7e18c4a9303a174fb6d2abc6b64',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
|
@ -1463,6 +1463,24 @@
|
|||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'yajra/laravel-datatables-buttons' => array(
|
||||
'pretty_version' => 'v10.0.8',
|
||||
'version' => '10.0.8.0',
|
||||
'reference' => 'cdd2b907f892cba4b840b4ed14f73bc73086d0cf',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../yajra/laravel-datatables-buttons',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'yajra/laravel-datatables-html' => array(
|
||||
'pretty_version' => 'v10.12.0',
|
||||
'version' => '10.12.0.0',
|
||||
'reference' => '1c0fc1ff2026457ff29ab1a6a3433a44d59b251d',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../yajra/laravel-datatables-html',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'yajra/laravel-datatables-oracle' => array(
|
||||
'pretty_version' => 'v10.6.0',
|
||||
'version' => '10.6.0.0',
|
||||
|
|
|
|||
38
vendor/yajra/laravel-datatables-buttons/CHANGELOG.md
vendored
Normal file
38
vendor/yajra/laravel-datatables-buttons/CHANGELOG.md
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# Laravel DataTables Buttons Plugin CHANGELOG.
|
||||
|
||||
## v10.0.8 - 2023-11-15
|
||||
|
||||
- fix: unnecessary exception thrown #183
|
||||
|
||||
## v10.0.7 - 2023-07-31
|
||||
|
||||
- fix: use callback function if exportRender method is set #177
|
||||
|
||||
## v10.0.6 - 2023-02-28
|
||||
|
||||
- fix: export package integration error message #174
|
||||
|
||||
## v10.0.5 - 2023-02-28
|
||||
|
||||
- fix: prevent redeclaring export query generator function (Laravel Octane) #173
|
||||
|
||||
## v10.0.4 - 2023-02-21
|
||||
|
||||
- fix: stubs - remove redundant docs #172
|
||||
- fix: default model namespace
|
||||
|
||||
## v10.0.3 - 2023-02-20
|
||||
|
||||
- fix: default model namespace config #171
|
||||
|
||||
## v10.0.2 - 2023-02-20
|
||||
|
||||
- fix: scopes when using api resource #170
|
||||
|
||||
## v10.0.1 - 2023-02-20
|
||||
|
||||
- fix: applyScopes method to support Collection #168
|
||||
|
||||
## v10.0.0 - 2023-02-07
|
||||
|
||||
- Add Laravel 10 compatibility #169
|
||||
19
vendor/yajra/laravel-datatables-buttons/CONTRIBUTING.md
vendored
Normal file
19
vendor/yajra/laravel-datatables-buttons/CONTRIBUTING.md
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Contributing
|
||||
|
||||
Contributions are **welcome** and will be fully **credited**.
|
||||
|
||||
We accept contributions via Pull Requests on [Github](https://github.com/yajra/laravel-datatables-buttons).
|
||||
|
||||
|
||||
## Pull Requests
|
||||
|
||||
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
|
||||
|
||||
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
|
||||
|
||||
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
|
||||
|
||||
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.
|
||||
|
||||
|
||||
**Happy coding**!
|
||||
22
vendor/yajra/laravel-datatables-buttons/LICENSE.md
vendored
Normal file
22
vendor/yajra/laravel-datatables-buttons/LICENSE.md
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013-2018 Arjay Angeles <aqangeles@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
62
vendor/yajra/laravel-datatables-buttons/README.md
vendored
Normal file
62
vendor/yajra/laravel-datatables-buttons/README.md
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
# Laravel DataTables Buttons Plugin
|
||||
|
||||
[](http://laravel.com)
|
||||
[](https://packagist.org/packages/yajra/laravel-datatables-buttons)
|
||||
[](https://github.com/yajra/laravel-datatables-buttons/actions/workflows/continuous-integration.yml)
|
||||
[](https://github.com/yajra/laravel-datatables-buttons/actions/workflows/static-analysis.yml)
|
||||
[](https://scrutinizer-ci.com/g/yajra/laravel-datatables-buttons/?branch=master)
|
||||
[](https://packagist.org/packages/yajra/laravel-datatables-buttons)
|
||||
[](https://packagist.org/packages/yajra/laravel-datatables-buttons)
|
||||
|
||||
This package is a plugin of [Laravel DataTables](https://github.com/yajra/laravel-datatables) for handling server-side function of exporting the table as csv, excel, pdf and printing.
|
||||
|
||||
## Requirements
|
||||
|
||||
- [PHP >= 8.1](http://php.net/)
|
||||
- [Laravel 10.x](https://github.com/laravel/framework)
|
||||
- [Laravel DataTables](https://github.com/yajra/laravel-datatables)
|
||||
- [jQuery DataTables v1.10.x](http://datatables.net/)
|
||||
- [jQuery DataTables Buttons Extension](https://datatables.net/reference/button/)
|
||||
|
||||
## Documentations
|
||||
|
||||
- [Laravel DataTables Documentation](http://yajrabox.com/docs/laravel-datatables)
|
||||
|
||||
## Laravel Version Compatibility
|
||||
|
||||
| Laravel | Package |
|
||||
|:--------------|:--------|
|
||||
| 8.x and below | 4.x |
|
||||
| 9.x | 9.x |
|
||||
| 10.x | 10.x |
|
||||
|
||||
## Quick Installation
|
||||
|
||||
`composer require yajra/laravel-datatables-buttons:^10`
|
||||
|
||||
#### Service Provider (Optional on Laravel 5.5)
|
||||
|
||||
`Yajra\DataTables\ButtonsServiceProvider::class`
|
||||
|
||||
#### Configuration and Assets (Optional)
|
||||
|
||||
`$ php artisan vendor:publish --tag=datatables-buttons --force`
|
||||
|
||||
And that's it! Start building out some awesome DataTables!
|
||||
|
||||
## Contributing
|
||||
|
||||
Please see [CONTRIBUTING](https://github.com/yajra/laravel-datatables-buttons/blob/master/.github/CONTRIBUTING.md) for details.
|
||||
|
||||
## Security
|
||||
|
||||
If you discover any security related issues, please email [aqangeles@gmail.com](mailto:aqangeles@gmail.com) instead of using the issue tracker.
|
||||
|
||||
## Credits
|
||||
|
||||
- [Arjay Angeles](https://github.com/yajra)
|
||||
- [All Contributors](https://github.com/yajra/laravel-datatables-buttons/graphs/contributors)
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT). Please see [License File](https://github.com/yajra/laravel-datatables-buttons/blob/master/LICENSE.md) for more information.
|
||||
65
vendor/yajra/laravel-datatables-buttons/composer.json
vendored
Normal file
65
vendor/yajra/laravel-datatables-buttons/composer.json
vendored
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
"name": "yajra/laravel-datatables-buttons",
|
||||
"description": "Laravel DataTables Buttons Plugin.",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"datatables",
|
||||
"buttons",
|
||||
"jquery"
|
||||
],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Arjay Angeles",
|
||||
"email": "aqangeles@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"yajra/laravel-datatables-oracle": "^10",
|
||||
"yajra/laravel-datatables-html": "^10",
|
||||
"illuminate/console": "^10"
|
||||
},
|
||||
"require-dev": {
|
||||
"maatwebsite/excel": "^3.1.46",
|
||||
"nunomaduro/larastan": "^2.4",
|
||||
"orchestra/testbench": "^8",
|
||||
"rap2hpoutre/fast-excel": "^5.1",
|
||||
"barryvdh/laravel-snappy": "^1.0.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Yajra\\DataTables\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Yajra\\DataTables\\Buttons\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "10.0-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Yajra\\DataTables\\ButtonsServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"suggest": {
|
||||
"yajra/laravel-datatables-export": "Exporting of dataTables (excel, csv and PDF) via livewire and queue worker.",
|
||||
"maatwebsite/excel": "Exporting of dataTables (excel, csv and PDF) using maatwebsite package.",
|
||||
"rap2hpoutre/fast-excel": "Faster exporting of dataTables using fast-excel package.",
|
||||
"dompdf/dompdf": "Allows exporting of dataTable to PDF using the DomPDF.",
|
||||
"barryvdh/laravel-snappy": "Allows exporting of dataTable to PDF using the print view."
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/yajra"
|
||||
}
|
||||
]
|
||||
}
|
||||
70
vendor/yajra/laravel-datatables-buttons/src/ButtonsServiceProvider.php
vendored
Normal file
70
vendor/yajra/laravel-datatables-buttons/src/ButtonsServiceProvider.php
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Maatwebsite\Excel\ExcelServiceProvider;
|
||||
use Yajra\DataTables\Generators\DataTablesHtmlCommand;
|
||||
use Yajra\DataTables\Generators\DataTablesMakeCommand;
|
||||
use Yajra\DataTables\Generators\DataTablesScopeCommand;
|
||||
|
||||
class ButtonsServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadViewsFrom(__DIR__.'/resources/views', 'datatables');
|
||||
|
||||
$this->publishAssets();
|
||||
|
||||
$this->registerCommands();
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish datatables assets.
|
||||
*/
|
||||
protected function publishAssets(): void
|
||||
{
|
||||
$this->publishes([
|
||||
__DIR__.'/config/config.php' => config_path('datatables-buttons.php'),
|
||||
], 'datatables-buttons');
|
||||
|
||||
$this->publishes([
|
||||
__DIR__.'/resources/assets/buttons.server-side.js' => public_path('vendor/datatables/buttons.server-side.js'),
|
||||
], 'datatables-buttons');
|
||||
|
||||
$this->publishes([
|
||||
__DIR__.'/resources/views' => base_path('/resources/views/vendor/datatables'),
|
||||
], 'datatables-buttons');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register datatables commands.
|
||||
*/
|
||||
protected function registerCommands(): void
|
||||
{
|
||||
$this->commands(DataTablesMakeCommand::class);
|
||||
$this->commands(DataTablesScopeCommand::class);
|
||||
$this->commands(DataTablesHtmlCommand::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->mergeConfigFrom(__DIR__.'/config/config.php', 'datatables-buttons');
|
||||
|
||||
$this->app->register(HtmlServiceProvider::class);
|
||||
|
||||
if (class_exists(ExcelServiceProvider::class)) {
|
||||
$this->app->register(ExcelServiceProvider::class);
|
||||
}
|
||||
}
|
||||
}
|
||||
34
vendor/yajra/laravel-datatables-buttons/src/Contracts/DataTableButtons.php
vendored
Normal file
34
vendor/yajra/laravel-datatables-buttons/src/Contracts/DataTableButtons.php
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Contracts;
|
||||
|
||||
interface DataTableButtons
|
||||
{
|
||||
/**
|
||||
* Export to excel file.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function excel();
|
||||
|
||||
/**
|
||||
* Export to CSV file.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function csv();
|
||||
|
||||
/**
|
||||
* Export to PDF file.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function pdf();
|
||||
|
||||
/**
|
||||
* Display printer friendly view.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function printPreview();
|
||||
}
|
||||
13
vendor/yajra/laravel-datatables-buttons/src/Contracts/DataTableHtmlBuilder.php
vendored
Normal file
13
vendor/yajra/laravel-datatables-buttons/src/Contracts/DataTableHtmlBuilder.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Contracts;
|
||||
|
||||
interface DataTableHtmlBuilder
|
||||
{
|
||||
/**
|
||||
* Handle building of dataTables html.
|
||||
*
|
||||
* @return \Yajra\DataTables\Html\Builder
|
||||
*/
|
||||
public function handle();
|
||||
}
|
||||
14
vendor/yajra/laravel-datatables-buttons/src/Contracts/DataTableScope.php
vendored
Normal file
14
vendor/yajra/laravel-datatables-buttons/src/Contracts/DataTableScope.php
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Contracts;
|
||||
|
||||
interface DataTableScope
|
||||
{
|
||||
/**
|
||||
* Apply a query scope.
|
||||
*
|
||||
* @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Relations\Relation|\Illuminate\Support\Collection|\Illuminate\Http\Resources\Json\AnonymousResourceCollection $query
|
||||
* @return mixed
|
||||
*/
|
||||
public function apply($query);
|
||||
}
|
||||
49
vendor/yajra/laravel-datatables-buttons/src/Exports/DataTablesCollectionExport.php
vendored
Normal file
49
vendor/yajra/laravel-datatables-buttons/src/Exports/DataTablesCollectionExport.php
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Exports;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\LazyCollection;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
|
||||
abstract class DataTablesCollectionExport implements FromCollection, WithHeadings
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
/**
|
||||
* @var Collection|LazyCollection
|
||||
*/
|
||||
protected $collection;
|
||||
|
||||
/**
|
||||
* @param Collection|LazyCollection|null $collection
|
||||
*/
|
||||
public function __construct($collection = null)
|
||||
{
|
||||
$this->collection = $collection ?? new Collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection|LazyCollection
|
||||
*/
|
||||
public function collection()
|
||||
{
|
||||
return $this->collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function headings(): array
|
||||
{
|
||||
/** @var array $first */
|
||||
$first = $this->collection->first();
|
||||
if ($first) {
|
||||
return array_keys($first);
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
97
vendor/yajra/laravel-datatables-buttons/src/Generators/DataTablesHtmlCommand.php
vendored
Normal file
97
vendor/yajra/laravel-datatables-buttons/src/Generators/DataTablesHtmlCommand.php
vendored
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Generators;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DataTablesHtmlCommand extends DataTablesMakeCommand
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'datatables:html
|
||||
{name : The name of the DataTable html.}
|
||||
{--dom= : The dom of the DataTable.}
|
||||
{--buttons= : The buttons of the DataTable.}
|
||||
{--table= : Scaffold columns from the table.}
|
||||
{--builder : Ignore, added to work with parent generator.}
|
||||
{--columns= : The columns of the DataTable.}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a new DataTable html class.';
|
||||
|
||||
/**
|
||||
* The type of class being generated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'DataTableHtml';
|
||||
|
||||
/**
|
||||
* Build the class with the given name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
protected function buildClass($name): string
|
||||
{
|
||||
$stub = $this->files->get($this->getStub());
|
||||
|
||||
$stub = $this->replaceNamespace($stub, $name)->replaceClass($stub, $name);
|
||||
|
||||
$this->replaceBuilder($stub)
|
||||
->replaceColumns($stub)
|
||||
->replaceButtons($stub)
|
||||
->replaceDOM($stub)
|
||||
->replaceTableId($stub);
|
||||
|
||||
return $stub;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub(): string
|
||||
{
|
||||
return config('datatables-buttons.stub')
|
||||
? base_path().config('datatables-buttons.stub').'/html.stub'
|
||||
: __DIR__.'/stubs/html.stub';
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the name and format according to the root namespace.
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
protected function qualifyClass($name): string
|
||||
{
|
||||
$rootNamespace = $this->laravel->getNamespace();
|
||||
|
||||
if (Str::startsWith($name, $rootNamespace)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
if (Str::contains($name, '/')) {
|
||||
$name = str_replace('/', '\\', $name);
|
||||
}
|
||||
|
||||
if (! Str::contains(Str::lower($name), 'datatablehtml')) {
|
||||
$name .= 'DataTableHtml';
|
||||
} else {
|
||||
$name = preg_replace('#datatablehtml$#i', 'DataTableHtml', $name);
|
||||
}
|
||||
|
||||
return $this->getDefaultNamespace(trim($rootNamespace, '\\')).'\\'.$name;
|
||||
}
|
||||
}
|
||||
423
vendor/yajra/laravel-datatables-buttons/src/Generators/DataTablesMakeCommand.php
vendored
Normal file
423
vendor/yajra/laravel-datatables-buttons/src/Generators/DataTablesMakeCommand.php
vendored
Normal file
|
|
@ -0,0 +1,423 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Generators;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DataTablesMakeCommand extends GeneratorCommand
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'datatables:make
|
||||
{name : The name of the DataTable.}
|
||||
{--model= : The name of the model to be used.}
|
||||
{--model-namespace= : The namespace of the model to be used.}
|
||||
{--action= : The path of the action view.}
|
||||
{--table= : Scaffold columns from the table.}
|
||||
{--builder : Extract html() to a Builder class.}
|
||||
{--dom= : The dom of the DataTable.}
|
||||
{--buttons= : The buttons of the DataTable.}
|
||||
{--columns= : The columns of the DataTable.}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a new DataTable service class.';
|
||||
|
||||
/**
|
||||
* The type of class being generated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'DataTable';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
parent::handle();
|
||||
|
||||
if ($this->option('builder')) {
|
||||
$columns = config('datatables-buttons.generator.columns', 'id,add your columns,created_at,updated_at');
|
||||
$buttons = config('datatables-buttons.generator.buttons', 'create,export,print,reset,reload');
|
||||
$dom = config('datatables-buttons.generator.dom', 'Bfrtip');
|
||||
|
||||
$this->call('datatables:html', [
|
||||
'name' => $this->getDataTableBaseName(),
|
||||
'--columns' => $this->option('columns') ?: $columns,
|
||||
'--buttons' => $this->option('buttons') ?: $buttons,
|
||||
'--dom' => $this->option('dom') ?: $dom,
|
||||
'--table' => $this->option('table'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the class with the given name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
protected function buildClass($name): string
|
||||
{
|
||||
$stub = parent::buildClass($name);
|
||||
|
||||
$this->replaceModelImport($stub)
|
||||
->replaceModel($stub)
|
||||
->replaceBuilder($stub)
|
||||
->replaceColumns($stub)
|
||||
->replaceButtons($stub)
|
||||
->replaceDOM($stub)
|
||||
->replaceTableId($stub)
|
||||
->replaceAction($stub)
|
||||
->replaceFilename($stub);
|
||||
|
||||
return $stub;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get DataTable class base name without the suffix.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getDataTableBaseName(): string
|
||||
{
|
||||
return (string) preg_replace('#datatable$#i', '', $this->getNameInput());
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare model name from input.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function prepareModelName(): string
|
||||
{
|
||||
return basename($this->getDataTableBaseName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the filename.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return $this
|
||||
*/
|
||||
protected function replaceFilename(string &$stub): static
|
||||
{
|
||||
$stub = str_replace('DummyFilename', $this->prepareModelName(), $stub);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the action.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return static
|
||||
*/
|
||||
protected function replaceAction(string &$stub): static
|
||||
{
|
||||
$stub = str_replace('DummyAction', $this->getAction(), $stub);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the action view to be used.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getAction(): string
|
||||
{
|
||||
/** @var string $action */
|
||||
$action = $this->option('action');
|
||||
|
||||
if ($action) {
|
||||
return $action;
|
||||
}
|
||||
|
||||
return Str::lower($this->prepareModelName()).'.action';
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace columns.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return $this
|
||||
*/
|
||||
protected function replaceTableId(string &$stub): static
|
||||
{
|
||||
$stub = str_replace('DummyTableId', Str::lower($this->prepareModelName()).'-table', $stub);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace dom.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return $this
|
||||
*/
|
||||
protected function replaceDOM(string &$stub): static
|
||||
{
|
||||
/** @var string $dom */
|
||||
$dom = $this->option('dom') ?: config('datatables-buttons.generator.dom', 'Bfrtip');
|
||||
|
||||
$stub = str_replace('DummyDOM', $dom, $stub);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace buttons.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return $this
|
||||
*/
|
||||
protected function replaceButtons(string &$stub): static
|
||||
{
|
||||
$stub = str_replace('DummyButtons', $this->getButtons(), $stub);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the columns to be used.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getButtons(): string
|
||||
{
|
||||
/** @var string $buttons */
|
||||
$buttons = $this->option('buttons');
|
||||
|
||||
if ($buttons) {
|
||||
return $this->parseButtons($buttons);
|
||||
}
|
||||
|
||||
/** @var string $buttons */
|
||||
$buttons = config('datatables-buttons.generator.buttons', 'create,export,print,reset,reload');
|
||||
|
||||
return $this->parseButtons($buttons);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse array from definition.
|
||||
*
|
||||
* @param string $definition
|
||||
* @param int $indentation
|
||||
* @return string
|
||||
*/
|
||||
protected function parseButtons(string $definition, int $indentation = 24): string
|
||||
{
|
||||
$columns = explode(',', $definition);
|
||||
$stub = '';
|
||||
foreach ($columns as $key => $column) {
|
||||
$indent = '';
|
||||
$separator = ',';
|
||||
|
||||
if ($key < count($columns) - 1) {
|
||||
$indent = PHP_EOL.str_repeat(' ', $indentation);
|
||||
}
|
||||
|
||||
if ($key == count($columns) - 1) {
|
||||
$separator = '';
|
||||
}
|
||||
|
||||
$stub .= "Button::make('{$column}')".$separator.$indent;
|
||||
}
|
||||
|
||||
return $stub;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace columns.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return $this
|
||||
*/
|
||||
protected function replaceColumns(string &$stub): static
|
||||
{
|
||||
$stub = str_replace('DummyColumns', $this->getColumns(), $stub);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the columns to be used.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getColumns(): string
|
||||
{
|
||||
/** @var string $table */
|
||||
$table = $this->option('table');
|
||||
|
||||
if ($table) {
|
||||
return $this->parseColumns(Schema::getColumnListing($table));
|
||||
}
|
||||
|
||||
/** @var string $columns */
|
||||
$columns = $this->option('columns');
|
||||
|
||||
if ($columns) {
|
||||
return $this->parseColumns($columns);
|
||||
}
|
||||
|
||||
/** @var string $columns */
|
||||
$columns = config('datatables-buttons.generator.columns', 'id,add your columns,created_at,updated_at');
|
||||
|
||||
return $this->parseColumns($columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse array from definition.
|
||||
*
|
||||
* @param array|string $definition
|
||||
* @param int $indentation
|
||||
* @return string
|
||||
*/
|
||||
protected function parseColumns(array|string $definition, int $indentation = 12): string
|
||||
{
|
||||
$columns = is_array($definition) ? $definition : explode(',', $definition);
|
||||
$stub = '';
|
||||
foreach ($columns as $key => $column) {
|
||||
$stub .= "Column::make('{$column}'),";
|
||||
|
||||
if ($key < count($columns) - 1) {
|
||||
$stub .= PHP_EOL.str_repeat(' ', $indentation);
|
||||
}
|
||||
}
|
||||
|
||||
return $stub;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace builder name.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return \Yajra\DataTables\Generators\DataTablesMakeCommand
|
||||
*/
|
||||
protected function replaceBuilder(&$stub)
|
||||
{
|
||||
$name = $this->qualifyClass($this->getNameInput());
|
||||
$class = str_replace($this->getNamespace($name).'\\', '', $name);
|
||||
|
||||
$stub = str_replace('DummyBuilder', $class.'Html', $stub);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the name and format according to the root namespace.
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
protected function qualifyClass($name)
|
||||
{
|
||||
$rootNamespace = $this->laravel->getNamespace();
|
||||
|
||||
if (Str::startsWith($name, $rootNamespace)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
if (Str::contains($name, '/')) {
|
||||
$name = str_replace('/', '\\', $name);
|
||||
}
|
||||
|
||||
if (! Str::contains(Str::lower($name), 'datatable')) {
|
||||
$name .= 'DataTable';
|
||||
} else {
|
||||
$name = preg_replace('#datatable$#i', 'DataTable', $name);
|
||||
}
|
||||
|
||||
return $this->getDefaultNamespace(trim($rootNamespace, '\\')).'\\'.$name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultNamespace($rootNamespace): string
|
||||
{
|
||||
return $rootNamespace.'\\'.config('datatables-buttons.namespace.base', 'DataTables');
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace model name.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return static
|
||||
*/
|
||||
protected function replaceModel(string &$stub): static
|
||||
{
|
||||
$model = explode('\\', $this->getModel());
|
||||
$model = array_pop($model);
|
||||
$stub = str_replace('ModelName', $model, $stub);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get model name to use.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getModel(): string
|
||||
{
|
||||
/** @var string $modelFromOption */
|
||||
$modelFromOption = $this->option('model');
|
||||
$modelNamespaceFromOption = $this->option('model-namespace')
|
||||
? $this->option('model-namespace')
|
||||
: config('datatables-buttons.namespace.model');
|
||||
|
||||
$name = $modelFromOption ?: $this->prepareModelName();
|
||||
$modelNamespace = $modelNamespaceFromOption ?: $this->laravel->getNamespace();
|
||||
|
||||
if (empty($modelNamespaceFromOption) && is_dir(app_path('Models'))) {
|
||||
$modelNamespace = $modelNamespace.'\\Models\\';
|
||||
}
|
||||
|
||||
return $modelNamespace.'\\'.Str::singular($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace model import.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return $this
|
||||
*/
|
||||
protected function replaceModelImport(string &$stub): static
|
||||
{
|
||||
$stub = str_replace('DummyModel', str_replace('\\\\', '\\', $this->getModel()), $stub);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub(): string
|
||||
{
|
||||
$stub = 'datatables.stub';
|
||||
|
||||
if ($this->option('builder')) {
|
||||
$stub = 'builder.stub';
|
||||
}
|
||||
|
||||
return config('datatables-buttons.stub')
|
||||
? base_path().config('datatables-buttons.stub')."/$stub"
|
||||
: __DIR__."/stubs/{$stub}";
|
||||
}
|
||||
}
|
||||
54
vendor/yajra/laravel-datatables-buttons/src/Generators/DataTablesScopeCommand.php
vendored
Normal file
54
vendor/yajra/laravel-datatables-buttons/src/Generators/DataTablesScopeCommand.php
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Generators;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
|
||||
class DataTablesScopeCommand extends GeneratorCommand
|
||||
{
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'datatables:scope';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a new DataTable Scope class.';
|
||||
|
||||
/**
|
||||
* The type of class being generated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'DataTable Scope';
|
||||
|
||||
/**
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultNamespace($rootNamespace): string
|
||||
{
|
||||
return $rootNamespace.'\DataTables\Scopes';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub(): string
|
||||
{
|
||||
if ($stubFolder = config('datatables-buttons.stub')) {
|
||||
return base_path($stubFolder.'/scopes.stub');
|
||||
}
|
||||
|
||||
return __DIR__.'/stubs/scopes.stub';
|
||||
}
|
||||
}
|
||||
48
vendor/yajra/laravel-datatables-buttons/src/Generators/stubs/builder.stub
vendored
Normal file
48
vendor/yajra/laravel-datatables-buttons/src/Generators/stubs/builder.stub
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
|
||||
use DummyModel;
|
||||
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
||||
use Yajra\DataTables\EloquentDataTable;
|
||||
use Yajra\DataTables\Html\Builder as HtmlBuilder;
|
||||
use Yajra\DataTables\Services\DataTable;
|
||||
|
||||
class DummyClass extends DataTable
|
||||
{
|
||||
/**
|
||||
* Build the DataTable class.
|
||||
*
|
||||
* @param QueryBuilder $query Results from query() method.
|
||||
*/
|
||||
public function dataTable(QueryBuilder $query): EloquentDataTable
|
||||
{
|
||||
return (new EloquentDataTable($query))
|
||||
->addColumn('action', 'DummyAction')
|
||||
->setRowId('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the query source of dataTable.
|
||||
*/
|
||||
public function query(ModelName $model): QueryBuilder
|
||||
{
|
||||
return $model->newQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional method if you want to use the html builder.
|
||||
*/
|
||||
public function html(): HtmlBuilder
|
||||
{
|
||||
return DummyBuilder::make();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filename for export.
|
||||
*/
|
||||
protected function filename(): string
|
||||
{
|
||||
return 'DummyFilename_' . date('YmdHis');
|
||||
}
|
||||
}
|
||||
76
vendor/yajra/laravel-datatables-buttons/src/Generators/stubs/datatables.stub
vendored
Normal file
76
vendor/yajra/laravel-datatables-buttons/src/Generators/stubs/datatables.stub
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
|
||||
use DummyModel;
|
||||
use Yajra\DataTables\Html\Button;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use Yajra\DataTables\Services\DataTable;
|
||||
use Yajra\DataTables\Html\Editor\Fields;
|
||||
use Yajra\DataTables\Html\Editor\Editor;
|
||||
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
||||
use Yajra\DataTables\EloquentDataTable;
|
||||
use Yajra\DataTables\Html\Builder as HtmlBuilder;
|
||||
|
||||
class DummyClass extends DataTable
|
||||
{
|
||||
/**
|
||||
* Build the DataTable class.
|
||||
*
|
||||
* @param QueryBuilder $query Results from query() method.
|
||||
*/
|
||||
public function dataTable(QueryBuilder $query): EloquentDataTable
|
||||
{
|
||||
return (new EloquentDataTable($query))
|
||||
->addColumn('action', 'DummyAction')
|
||||
->setRowId('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the query source of dataTable.
|
||||
*/
|
||||
public function query(ModelName $model): QueryBuilder
|
||||
{
|
||||
return $model->newQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional method if you want to use the html builder.
|
||||
*/
|
||||
public function html(): HtmlBuilder
|
||||
{
|
||||
return $this->builder()
|
||||
->setTableId('DummyTableId')
|
||||
->columns($this->getColumns())
|
||||
->minifiedAjax()
|
||||
//->dom('DummyDOM')
|
||||
->orderBy(1)
|
||||
->selectStyleSingle()
|
||||
->buttons([
|
||||
DummyButtons
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the dataTable columns definition.
|
||||
*/
|
||||
public function getColumns(): array
|
||||
{
|
||||
return [
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(60)
|
||||
->addClass('text-center'),
|
||||
DummyColumns
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filename for export.
|
||||
*/
|
||||
protected function filename(): string
|
||||
{
|
||||
return 'DummyFilename_' . date('YmdHis');
|
||||
}
|
||||
}
|
||||
45
vendor/yajra/laravel-datatables-buttons/src/Generators/stubs/html.stub
vendored
Normal file
45
vendor/yajra/laravel-datatables-buttons/src/Generators/stubs/html.stub
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
|
||||
use Yajra\DataTables\Html\Button;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use Yajra\DataTables\Html\DataTableHtml;
|
||||
use Yajra\DataTables\Html\Editor\Fields;
|
||||
use Yajra\DataTables\Html\Editor\Editor;
|
||||
|
||||
class DummyClass extends DataTableHtml
|
||||
{
|
||||
/**
|
||||
* Build the html builder.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function handle(): Builder
|
||||
{
|
||||
return $this->setTableId('DummyTableId')
|
||||
->columns($this->getColumns())
|
||||
->minifiedAjax()
|
||||
//->dom('DummyDOM')
|
||||
->orderBy(1)
|
||||
->selectStyleSingle()
|
||||
->buttons([
|
||||
DummyButtons
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the dataTable columns definition.
|
||||
*/
|
||||
public function getColumns(): array
|
||||
{
|
||||
return [
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(60)
|
||||
->addClass('text-center'),
|
||||
DummyColumns
|
||||
];
|
||||
}
|
||||
}
|
||||
19
vendor/yajra/laravel-datatables-buttons/src/Generators/stubs/scopes.stub
vendored
Normal file
19
vendor/yajra/laravel-datatables-buttons/src/Generators/stubs/scopes.stub
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
|
||||
use Yajra\DataTables\Contracts\DataTableScope;
|
||||
|
||||
class DummyClass implements DataTableScope
|
||||
{
|
||||
/**
|
||||
* Apply a query scope.
|
||||
*
|
||||
* @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $query
|
||||
* @return mixed
|
||||
*/
|
||||
public function apply($query)
|
||||
{
|
||||
// return $query->where('id', 1);
|
||||
}
|
||||
}
|
||||
58
vendor/yajra/laravel-datatables-buttons/src/Html/DataTableHtml.php
vendored
Normal file
58
vendor/yajra/laravel-datatables-buttons/src/Html/DataTableHtml.php
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html;
|
||||
|
||||
use BadMethodCallException;
|
||||
use Yajra\DataTables\Contracts\DataTableHtmlBuilder;
|
||||
|
||||
/**
|
||||
* @mixin Builder
|
||||
*/
|
||||
abstract class DataTableHtml implements DataTableHtmlBuilder
|
||||
{
|
||||
protected ?Builder $htmlBuilder = null;
|
||||
|
||||
public static function make(): Builder
|
||||
{
|
||||
if (func_get_args()) {
|
||||
return (new static(...func_get_args()))->handle();
|
||||
}
|
||||
|
||||
/** @var static $html */
|
||||
$html = app(static::class);
|
||||
|
||||
return $html->handle();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
* @param mixed $parameters
|
||||
* @return \Yajra\DataTables\Html\Builder
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __call(string $method, $parameters)
|
||||
{
|
||||
if (method_exists($this->getHtmlBuilder(), $method)) {
|
||||
return $this->getHtmlBuilder()->{$method}(...$parameters);
|
||||
}
|
||||
|
||||
throw new BadMethodCallException("Method {$method} does not exists");
|
||||
}
|
||||
|
||||
protected function getHtmlBuilder(): Builder
|
||||
{
|
||||
if ($this->htmlBuilder) {
|
||||
return $this->htmlBuilder;
|
||||
}
|
||||
|
||||
return $this->htmlBuilder = app(Builder::class);
|
||||
}
|
||||
|
||||
public function setHtmlBuilder(Builder $builder): static
|
||||
{
|
||||
$this->htmlBuilder = $builder;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
819
vendor/yajra/laravel-datatables-buttons/src/Services/DataTable.php
vendored
Normal file
819
vendor/yajra/laravel-datatables-buttons/src/Services/DataTable.php
vendored
Normal file
|
|
@ -0,0 +1,819 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Services;
|
||||
|
||||
use Barryvdh\Snappy\PdfWrapper;
|
||||
use Closure;
|
||||
use Generator;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||
use Illuminate\Database\Eloquent\Relations\Relation as EloquentRelation;
|
||||
use Illuminate\Database\Query\Builder as QueryBuilder;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\LazyCollection;
|
||||
use Maatwebsite\Excel\ExcelServiceProvider;
|
||||
use Rap2hpoutre\FastExcel\FastExcel;
|
||||
use Yajra\DataTables\Contracts\DataTableButtons;
|
||||
use Yajra\DataTables\Contracts\DataTableScope;
|
||||
use Yajra\DataTables\Exceptions\Exception;
|
||||
use Yajra\DataTables\Html\Builder;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use Yajra\DataTables\QueryDataTable;
|
||||
use Yajra\DataTables\Transformers\DataArrayTransformer;
|
||||
use Yajra\DataTables\Utilities\Request;
|
||||
|
||||
abstract class DataTable implements DataTableButtons
|
||||
{
|
||||
/**
|
||||
* DataTables print preview view.
|
||||
*
|
||||
* @phpstan-var view-string
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $printPreview = 'datatables::print';
|
||||
|
||||
/**
|
||||
* Name of the dataTable variable.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $dataTableVariable = 'dataTable';
|
||||
|
||||
/**
|
||||
* List of columns to be excluded from export.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected array $excludeFromExport = [];
|
||||
|
||||
/**
|
||||
* List of columns to be excluded from printing.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected array $excludeFromPrint = [];
|
||||
|
||||
/**
|
||||
* List of columns to be exported.
|
||||
*
|
||||
* @var string|array
|
||||
*/
|
||||
protected string|array $exportColumns = '*';
|
||||
|
||||
/**
|
||||
* List of columns to be printed.
|
||||
*
|
||||
* @var string|array
|
||||
*/
|
||||
protected string|array $printColumns = '*';
|
||||
|
||||
/**
|
||||
* Query scopes.
|
||||
*
|
||||
* @var \Yajra\DataTables\Contracts\DataTableScope[]
|
||||
*/
|
||||
protected array $scopes = [];
|
||||
|
||||
/**
|
||||
* Html builder.
|
||||
*
|
||||
* @var \Yajra\DataTables\Html\Builder|null
|
||||
*/
|
||||
protected ?Builder $htmlBuilder = null;
|
||||
|
||||
/**
|
||||
* Html builder extension callback.
|
||||
*
|
||||
* @var callable|null
|
||||
*/
|
||||
protected $htmlCallback;
|
||||
|
||||
/**
|
||||
* Export filename.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $filename = '';
|
||||
|
||||
/**
|
||||
* Custom attributes set on the class.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected array $attributes = [];
|
||||
|
||||
/**
|
||||
* Callback before sending the response.
|
||||
*
|
||||
* @var callable|null
|
||||
*/
|
||||
protected $beforeCallback;
|
||||
|
||||
/**
|
||||
* Callback after processing the response.
|
||||
*
|
||||
* @var callable|null
|
||||
*/
|
||||
protected $responseCallback;
|
||||
|
||||
/**
|
||||
* Available button actions. When calling an action, the value will be used
|
||||
* as the function name (so it should be available)
|
||||
* If you want to add or disable an action, overload and modify this property.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected array $actions = ['print', 'csv', 'excel', 'pdf'];
|
||||
|
||||
/**
|
||||
* @var \Yajra\DataTables\Utilities\Request|null
|
||||
*/
|
||||
protected ?Request $request = null;
|
||||
|
||||
/**
|
||||
* Flag to use fast-excel package for export.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected bool $fastExcel = false;
|
||||
|
||||
/**
|
||||
* Flag to enable/disable fast-excel callback.
|
||||
* Note: Disabling this flag can improve you export time.
|
||||
* Enabled by default to emulate the same output
|
||||
* with laravel-excel.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected bool $fastExcelCallback = true;
|
||||
|
||||
/**
|
||||
* Export class handler.
|
||||
*
|
||||
* @var class-string
|
||||
*/
|
||||
protected string $exportClass = DataTablesExportHandler::class;
|
||||
|
||||
/**
|
||||
* CSV export typewriter.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $csvWriter = 'Csv';
|
||||
|
||||
/**
|
||||
* Excel export typewriter.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $excelWriter = 'Xlsx';
|
||||
|
||||
/**
|
||||
* PDF export typewriter.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $pdfWriter = 'Dompdf';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
/** @var Request $request */
|
||||
$request = app('datatables.request');
|
||||
|
||||
/** @var Builder $builder */
|
||||
$builder = app('datatables.html');
|
||||
|
||||
$this->request = $request;
|
||||
$this->htmlBuilder = $builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process dataTables needed render output.
|
||||
*
|
||||
* @phpstan-param view-string|null $view
|
||||
*
|
||||
* @param string|null $view
|
||||
* @param array $data
|
||||
* @param array $mergeData
|
||||
* @return mixed
|
||||
*/
|
||||
public function render(string $view = null, array $data = [], array $mergeData = [])
|
||||
{
|
||||
if ($this->request()->ajax() && $this->request()->wantsJson()) {
|
||||
return app()->call([$this, 'ajax']);
|
||||
}
|
||||
|
||||
/** @var string $action */
|
||||
$action = $this->request()->get('action');
|
||||
$actionMethod = $action === 'print' ? 'printPreview' : $action;
|
||||
|
||||
if (in_array($action, $this->actions) && method_exists($this, $actionMethod)) {
|
||||
/** @var callable $callback */
|
||||
$callback = [$this, $actionMethod];
|
||||
|
||||
return app()->call($callback);
|
||||
}
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
return view($view, $data, $mergeData)->with($this->dataTableVariable, $this->getHtmlBuilder());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get DataTables Request instance.
|
||||
*
|
||||
* @return \Yajra\DataTables\Utilities\Request
|
||||
*/
|
||||
public function request(): Request
|
||||
{
|
||||
if (! $this->request) {
|
||||
$this->request = app(Request::class);
|
||||
}
|
||||
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display ajax response.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function ajax(): JsonResponse
|
||||
{
|
||||
$query = null;
|
||||
if (method_exists($this, 'query')) {
|
||||
/** @var EloquentBuilder|QueryBuilder|EloquentRelation $query */
|
||||
$query = app()->call([$this, 'query']);
|
||||
$query = $this->applyScopes($query);
|
||||
}
|
||||
|
||||
/** @var \Yajra\DataTables\DataTableAbstract $dataTable */
|
||||
// @phpstan-ignore-next-line
|
||||
$dataTable = app()->call([$this, 'dataTable'], compact('query'));
|
||||
|
||||
if (is_callable($this->beforeCallback)) {
|
||||
app()->call($this->beforeCallback, compact('dataTable'));
|
||||
}
|
||||
|
||||
if (is_callable($this->responseCallback)) {
|
||||
$data = new Collection($dataTable->toArray());
|
||||
|
||||
$response = app()->call($this->responseCallback, compact('data'));
|
||||
|
||||
return new JsonResponse($response);
|
||||
}
|
||||
|
||||
return $dataTable->toJson();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display printable view of datatables.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function printPreview(): Renderable
|
||||
{
|
||||
$data = $this->getDataForPrint();
|
||||
|
||||
return view($this->printPreview, compact('data'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mapped columns versus final decorated output.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getDataForPrint(): array
|
||||
{
|
||||
$columns = $this->printColumns();
|
||||
|
||||
return $this->mapResponseToColumns($columns, 'printable');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get printable columns.
|
||||
*
|
||||
* @return array|\Illuminate\Support\Collection
|
||||
*/
|
||||
protected function printColumns(): array|Collection
|
||||
{
|
||||
return is_array($this->printColumns) ? $this->toColumnsCollection($this->printColumns) : $this->getPrintColumnsFromBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get filtered print columns definition from html builder.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
protected function getPrintColumnsFromBuilder(): Collection
|
||||
{
|
||||
return $this->html()->removeColumn(...$this->excludeFromPrint)->getColumns();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get filtered export columns definition from html builder.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
protected function getExportColumnsFromBuilder(): Collection
|
||||
{
|
||||
return $this->html()->removeColumn(...$this->excludeFromExport)->getColumns();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get columns definition from html builder.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
protected function getColumnsFromBuilder(): Collection
|
||||
{
|
||||
return $this->html()->getColumns();
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional method if you want to use html builder.
|
||||
*
|
||||
* @return \Yajra\DataTables\Html\Builder
|
||||
*/
|
||||
public function html()
|
||||
{
|
||||
return $this->builder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get DataTables Html Builder instance.
|
||||
*
|
||||
* @return \Yajra\DataTables\Html\Builder
|
||||
*/
|
||||
public function builder(): Builder
|
||||
{
|
||||
if (method_exists($this, 'htmlBuilder')) {
|
||||
return $this->htmlBuilder = $this->htmlBuilder();
|
||||
}
|
||||
|
||||
if (! $this->htmlBuilder) {
|
||||
$this->htmlBuilder = app(Builder::class);
|
||||
}
|
||||
|
||||
return $this->htmlBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map ajax response to columns definition.
|
||||
*
|
||||
* @param array|Collection $columns
|
||||
* @param string $type
|
||||
* @return array
|
||||
*/
|
||||
protected function mapResponseToColumns($columns, string $type): array
|
||||
{
|
||||
$transformer = new DataArrayTransformer;
|
||||
|
||||
return array_map(function ($row) use ($columns, $type, $transformer) {
|
||||
return $transformer->transform($row, $columns, $type);
|
||||
}, $this->getAjaxResponseData());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get decorated data as defined in datatables ajax response.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getAjaxResponseData(): array
|
||||
{
|
||||
$this->request()->merge([
|
||||
'start' => 0,
|
||||
'length' => -1,
|
||||
]);
|
||||
|
||||
/** @var JsonResponse $response */
|
||||
$response = app()->call([$this, 'ajax']);
|
||||
|
||||
/** @var array{data: array} $data */
|
||||
$data = $response->getData(true);
|
||||
|
||||
return $data['data'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Yajra\DataTables\Html\Builder
|
||||
*/
|
||||
protected function getHtmlBuilder(): Builder
|
||||
{
|
||||
$builder = $this->html();
|
||||
if (is_callable($this->htmlCallback)) {
|
||||
app()->call($this->htmlCallback, compact('builder'));
|
||||
}
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add html builder callback hook.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function withHtml(callable $callback): static
|
||||
{
|
||||
$this->htmlCallback = $callback;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add callback before sending the response.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function before(callable $callback): static
|
||||
{
|
||||
$this->beforeCallback = $callback;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add callback after the response was processed.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function response(callable $callback): static
|
||||
{
|
||||
$this->responseCallback = $callback;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export results to Excel file.
|
||||
*
|
||||
* @return string|\Symfony\Component\HttpFoundation\BinaryFileResponse|\Symfony\Component\HttpFoundation\StreamedResponse
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function excel()
|
||||
{
|
||||
set_time_limit(3600);
|
||||
|
||||
$path = $this->getFilename().'.'.strtolower($this->excelWriter);
|
||||
|
||||
$excelFile = $this->buildExcelFile();
|
||||
|
||||
if ($excelFile instanceof FastExcel) {
|
||||
$callback = $this->fastExcelCallback ? $this->fastExcelCallback() : null;
|
||||
|
||||
return $excelFile->download($path, $callback);
|
||||
}
|
||||
|
||||
// @phpstan-ignore-next-line
|
||||
return $excelFile->download($path, $this->excelWriter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build Excel file and prepare for export.
|
||||
*
|
||||
* @return mixed|FastExcel
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function buildExcelFile()
|
||||
{
|
||||
if ($this->fastExcel) {
|
||||
return $this->buildFastExcelFile();
|
||||
}
|
||||
|
||||
if (! class_exists(ExcelServiceProvider::class)) {
|
||||
throw new Exception('Please `composer require maatwebsite/excel` to be able to use this function.');
|
||||
}
|
||||
|
||||
if (! new $this->exportClass instanceof DataTablesExportHandler) {
|
||||
$collection = $this->getAjaxResponseData();
|
||||
|
||||
return new $this->exportClass($this->convertToLazyCollection($collection));
|
||||
}
|
||||
|
||||
$collection = $this->getDataForExport();
|
||||
|
||||
return new $this->exportClass($this->convertToLazyCollection($collection));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get export filename.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFilename(): string
|
||||
{
|
||||
return $this->filename ?: $this->filename();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set export filename.
|
||||
*
|
||||
* @param string $filename
|
||||
* @return $this
|
||||
*/
|
||||
public function setFilename(string $filename): static
|
||||
{
|
||||
$this->filename = $filename;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get filename for export.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function filename(): string
|
||||
{
|
||||
return class_basename($this).'_'.date('YmdHis');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mapped columns versus final decorated output.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getDataForExport(): array
|
||||
{
|
||||
$columns = $this->exportColumns();
|
||||
|
||||
return $this->mapResponseToColumns($columns, 'exportable');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get export columns definition.
|
||||
*
|
||||
* @return Collection<int, Column>
|
||||
*/
|
||||
protected function exportColumns(): Collection
|
||||
{
|
||||
return is_array($this->exportColumns) ? $this->toColumnsCollection($this->exportColumns) : $this->getExportColumnsFromBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert array to collection of Column class.
|
||||
*
|
||||
* @param array $columns
|
||||
* @return Collection
|
||||
*/
|
||||
private function toColumnsCollection(array $columns): Collection
|
||||
{
|
||||
$collection = new Collection;
|
||||
|
||||
foreach ($columns as $column) {
|
||||
if (isset($column['data'])) {
|
||||
$column['title'] = $column['title'] ?? $column['data'];
|
||||
$collection->push(new Column($column));
|
||||
} else {
|
||||
$data = [];
|
||||
$data['data'] = $column;
|
||||
$data['title'] = $column;
|
||||
$collection->push(new Column($data));
|
||||
}
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export results to CSV file.
|
||||
*
|
||||
* @return string|\Symfony\Component\HttpFoundation\StreamedResponse
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function csv()
|
||||
{
|
||||
set_time_limit(3600);
|
||||
$path = $this->getFilename().'.'.strtolower($this->csvWriter);
|
||||
|
||||
$excelFile = $this->buildExcelFile();
|
||||
|
||||
if ($excelFile instanceof FastExcel) {
|
||||
$callback = $this->fastExcelCallback ? $this->fastExcelCallback() : null;
|
||||
|
||||
return $excelFile->download($path, $callback);
|
||||
}
|
||||
|
||||
// @phpstan-ignore-next-line
|
||||
return $this->buildExcelFile()->download($path, $this->csvWriter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Export results to PDF file.
|
||||
*
|
||||
* @return \Illuminate\Http\Response|string|\Symfony\Component\HttpFoundation\StreamedResponse
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function pdf()
|
||||
{
|
||||
if ('snappy' == config('datatables-buttons.pdf_generator', 'snappy')) {
|
||||
return $this->snappyPdf();
|
||||
}
|
||||
|
||||
// @phpstan-ignore-next-line
|
||||
return $this->buildExcelFile()->download($this->getFilename().'.pdf', $this->pdfWriter);
|
||||
}
|
||||
|
||||
/**
|
||||
* PDF version of the table using print preview blade template.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Yajra\DataTables\Exceptions\Exception
|
||||
*/
|
||||
public function snappyPdf(): Response
|
||||
{
|
||||
if (! class_exists(PdfWrapper::class)) {
|
||||
throw new Exception('Please `composer require barryvdh/laravel-snappy` to be able to use this feature.');
|
||||
}
|
||||
|
||||
/** @var \Barryvdh\Snappy\PdfWrapper $snappy */
|
||||
$snappy = app('snappy.pdf.wrapper');
|
||||
$options = (array) config('datatables-buttons.snappy.options');
|
||||
|
||||
/** @var string $orientation */
|
||||
$orientation = config('datatables-buttons.snappy.orientation');
|
||||
|
||||
$snappy->setOptions($options)->setOrientation($orientation);
|
||||
|
||||
return $snappy->loadHTML($this->printPreview())->download($this->getFilename().'.pdf');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add basic array query scopes.
|
||||
*
|
||||
* @param \Yajra\DataTables\Contracts\DataTableScope $scope
|
||||
* @return $this
|
||||
*/
|
||||
public function addScope(DataTableScope $scope): static
|
||||
{
|
||||
$this->scopes[] = $scope;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Push multiples scopes to array query scopes.
|
||||
*
|
||||
* @param array $scopes
|
||||
* @return $this
|
||||
*/
|
||||
public function addScopes(array $scopes): static
|
||||
{
|
||||
$this->scopes = array_merge($this->scopes, $scopes);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a custom class attribute.
|
||||
*
|
||||
* @param array|string $key
|
||||
* @param mixed|null $value
|
||||
* @return $this
|
||||
*/
|
||||
public function with(array|string $key, mixed $value = null): static
|
||||
{
|
||||
if (is_array($key)) {
|
||||
$this->attributes = array_merge($this->attributes, $key);
|
||||
} else {
|
||||
$this->attributes[$key] = $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically retrieve the value of an attribute.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function __get(string $key)
|
||||
{
|
||||
if (array_key_exists($key, $this->attributes)) {
|
||||
return $this->attributes[$key];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply query scopes.
|
||||
*/
|
||||
protected function applyScopes(
|
||||
EloquentBuilder|QueryBuilder|EloquentRelation|Collection|AnonymousResourceCollection $query
|
||||
): EloquentBuilder|QueryBuilder|EloquentRelation|Collection|AnonymousResourceCollection {
|
||||
foreach ($this->scopes as $scope) {
|
||||
$scope->apply($query);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the DataTable has scopes.
|
||||
*
|
||||
* @param array $scopes
|
||||
* @param bool $validateAll
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasScopes(array $scopes, bool $validateAll = false): bool
|
||||
{
|
||||
$filteredScopes = array_filter($this->scopes, function ($scope) use ($scopes) {
|
||||
return in_array(get_class($scope), $scopes);
|
||||
});
|
||||
|
||||
return $validateAll ? count($filteredScopes) === count($scopes) : ! empty($filteredScopes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default builder parameters.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getBuilderParameters(): array
|
||||
{
|
||||
/** @var array $defaults */
|
||||
$defaults = config('datatables-buttons.parameters', []);
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|\Illuminate\Support\Collection $collection
|
||||
* @return \Illuminate\Support\LazyCollection
|
||||
*/
|
||||
protected function convertToLazyCollection(array|Collection $collection): LazyCollection
|
||||
{
|
||||
if (is_array($collection)) {
|
||||
$collection = collect($collection);
|
||||
}
|
||||
|
||||
return $collection->lazy();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Closure
|
||||
*/
|
||||
public function fastExcelCallback(): Closure
|
||||
{
|
||||
return function ($row) {
|
||||
$mapped = [];
|
||||
|
||||
$this->exportColumns()->each(function (Column $column) use (&$mapped, $row) {
|
||||
if ($column['exportable']) {
|
||||
$mapped[$column['title']] = $row[$column['data']];
|
||||
}
|
||||
});
|
||||
|
||||
return $mapped;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Rap2hpoutre\FastExcel\FastExcel
|
||||
*
|
||||
* @throws \Yajra\DataTables\Exceptions\Exception
|
||||
*/
|
||||
protected function buildFastExcelFile(): FastExcel
|
||||
{
|
||||
if (! class_exists(FastExcel::class)) {
|
||||
throw new Exception('Please `composer require rap2hpoutre/fast-excel` to be able to use this function.');
|
||||
}
|
||||
|
||||
$query = null;
|
||||
if (method_exists($this, 'query')) {
|
||||
/** @var EloquentBuilder|QueryBuilder $query */
|
||||
$query = app()->call([$this, 'query']);
|
||||
$query = $this->applyScopes($query);
|
||||
}
|
||||
|
||||
/** @var \Yajra\DataTables\DataTableAbstract $dataTable */
|
||||
// @phpstan-ignore-next-line
|
||||
$dataTable = app()->call([$this, 'dataTable'], compact('query'));
|
||||
$dataTable->skipPaging();
|
||||
|
||||
if ($dataTable instanceof QueryDataTable) {
|
||||
$queryGenerator = function ($dataTable): Generator {
|
||||
foreach ($dataTable->getFilteredQuery()->cursor() as $row) {
|
||||
yield $row;
|
||||
}
|
||||
};
|
||||
|
||||
return new FastExcel($queryGenerator($dataTable));
|
||||
}
|
||||
|
||||
return new FastExcel($dataTable->toArray()['data']);
|
||||
}
|
||||
}
|
||||
9
vendor/yajra/laravel-datatables-buttons/src/Services/DataTablesExportHandler.php
vendored
Normal file
9
vendor/yajra/laravel-datatables-buttons/src/Services/DataTablesExportHandler.php
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Services;
|
||||
|
||||
use Yajra\DataTables\Exports\DataTablesCollectionExport;
|
||||
|
||||
class DataTablesExportHandler extends DataTablesCollectionExport
|
||||
{
|
||||
}
|
||||
87
vendor/yajra/laravel-datatables-buttons/src/Transformers/DataArrayTransformer.php
vendored
Normal file
87
vendor/yajra/laravel-datatables-buttons/src/Transformers/DataArrayTransformer.php
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Transformers;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class DataArrayTransformer
|
||||
{
|
||||
/**
|
||||
* Transform row data by column's definition.
|
||||
*
|
||||
* @param array $row
|
||||
* @param array|Collection<array-key, Column> $columns
|
||||
* @param string $type
|
||||
* @return array
|
||||
*/
|
||||
public function transform(array $row, array|Collection $columns, string $type = 'printable'): array
|
||||
{
|
||||
if ($columns instanceof Collection) {
|
||||
return $this->buildColumnByCollection($row, $columns, $type);
|
||||
}
|
||||
|
||||
return Arr::only($row, $columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform row column by collection.
|
||||
*
|
||||
* @param array $row
|
||||
* @param Collection<array-key, Column> $columns
|
||||
* @param string $type
|
||||
* @return array
|
||||
*/
|
||||
protected function buildColumnByCollection(array $row, Collection $columns, string $type = 'printable'): array
|
||||
{
|
||||
$results = [];
|
||||
$columns->each(function (Column $column) use ($row, $type, &$results) {
|
||||
if ($column[$type]) {
|
||||
$title = $column->title;
|
||||
if (is_array($column->data)) {
|
||||
$key = $column->data['filter'] ?? $column->name ?? '';
|
||||
} else {
|
||||
$key = $column->data ?? $column->name;
|
||||
}
|
||||
|
||||
$data = Arr::get($row, $key) ?? '';
|
||||
|
||||
if ($type == 'exportable') {
|
||||
$title = $this->decodeContent($title);
|
||||
$data = is_array($data) ? json_encode($data) : $this->decodeContent($data);
|
||||
}
|
||||
|
||||
if (isset($column->exportRender)) {
|
||||
$callback = $column->exportRender;
|
||||
$results[$title] = $callback($row, $data);
|
||||
} else {
|
||||
$results[$title] = $data;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode content to a readable text value.
|
||||
*
|
||||
* @param mixed $data
|
||||
* @return mixed
|
||||
*/
|
||||
protected function decodeContent(mixed $data): mixed
|
||||
{
|
||||
if (is_bool($data)) {
|
||||
return $data ? 'True' : 'False';
|
||||
}
|
||||
|
||||
if (is_string($data)) {
|
||||
$decoded = html_entity_decode(trim(strip_tags($data)), ENT_QUOTES, 'UTF-8');
|
||||
|
||||
return (string) str_replace("\xc2\xa0", ' ', $decoded);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
91
vendor/yajra/laravel-datatables-buttons/src/config/config.php
vendored
Normal file
91
vendor/yajra/laravel-datatables-buttons/src/config/config.php
vendored
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
* Namespaces used by the generator.
|
||||
*/
|
||||
'namespace' => [
|
||||
/*
|
||||
* Base namespace/directory to create the new file.
|
||||
* This is appended on default Laravel namespace.
|
||||
* Usage: php artisan datatables:make User
|
||||
* Output: App\DataTables\UserDataTable
|
||||
* With Model: App\User (default model)
|
||||
* Export filename: users_timestamp
|
||||
*/
|
||||
'base' => 'DataTables',
|
||||
|
||||
/*
|
||||
* Base namespace/directory where your model's are located.
|
||||
* This is appended on default Laravel namespace.
|
||||
* Usage: php artisan datatables:make Post --model
|
||||
* Output: App\DataTables\PostDataTable
|
||||
* With Model: App\Post
|
||||
* Export filename: posts_timestamp
|
||||
*/
|
||||
'model' => 'App\\Models',
|
||||
],
|
||||
|
||||
/*
|
||||
* Set Custom stub folder
|
||||
*/
|
||||
//'stub' => '/resources/custom_stub',
|
||||
|
||||
/*
|
||||
* PDF generator to be used when converting the table to pdf.
|
||||
* Available generators: excel, snappy
|
||||
* Snappy package: barryvdh/laravel-snappy
|
||||
* Excel package: maatwebsite/excel
|
||||
*/
|
||||
'pdf_generator' => 'snappy',
|
||||
|
||||
/*
|
||||
* Snappy PDF options.
|
||||
*/
|
||||
'snappy' => [
|
||||
'options' => [
|
||||
'no-outline' => true,
|
||||
'margin-left' => '0',
|
||||
'margin-right' => '0',
|
||||
'margin-top' => '10mm',
|
||||
'margin-bottom' => '10mm',
|
||||
],
|
||||
'orientation' => 'landscape',
|
||||
],
|
||||
|
||||
/*
|
||||
* Default html builder parameters.
|
||||
*/
|
||||
'parameters' => [
|
||||
'dom' => 'Bfrtip',
|
||||
'order' => [[0, 'desc']],
|
||||
'buttons' => [
|
||||
'excel',
|
||||
'csv',
|
||||
'pdf',
|
||||
'print',
|
||||
'reset',
|
||||
'reload',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* Generator command default options value.
|
||||
*/
|
||||
'generator' => [
|
||||
/*
|
||||
* Default columns to generate when not set.
|
||||
*/
|
||||
'columns' => 'id,add your columns,created_at,updated_at',
|
||||
|
||||
/*
|
||||
* Default buttons to generate when not set.
|
||||
*/
|
||||
'buttons' => 'excel,csv,pdf,print,reset,reload',
|
||||
|
||||
/*
|
||||
* Default DOM to generate when not set.
|
||||
*/
|
||||
'dom' => 'Bfrtip',
|
||||
],
|
||||
];
|
||||
284
vendor/yajra/laravel-datatables-buttons/src/resources/assets/buttons.server-side.js
vendored
Normal file
284
vendor/yajra/laravel-datatables-buttons/src/resources/assets/buttons.server-side.js
vendored
Normal file
|
|
@ -0,0 +1,284 @@
|
|||
(function ($, DataTable) {
|
||||
"use strict";
|
||||
|
||||
var _buildParams = function (dt, action, onlyVisibles) {
|
||||
var params = dt.ajax.params();
|
||||
params.action = action;
|
||||
params._token = $('meta[name="csrf-token"]').attr('content');
|
||||
|
||||
if (onlyVisibles) {
|
||||
params.visible_columns = _getVisibleColumns();
|
||||
} else {
|
||||
params.visible_columns = null;
|
||||
}
|
||||
|
||||
return params;
|
||||
};
|
||||
|
||||
var _getVisibleColumns = function () {
|
||||
|
||||
var visible_columns = [];
|
||||
$.each(DataTable.settings[0].aoColumns, function (key, col) {
|
||||
if (col.bVisible) {
|
||||
visible_columns.push(col.name);
|
||||
}
|
||||
});
|
||||
|
||||
return visible_columns;
|
||||
};
|
||||
|
||||
var _downloadFromUrl = function (url, params) {
|
||||
var postUrl = url + '/export';
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', postUrl, true);
|
||||
xhr.responseType = 'arraybuffer';
|
||||
xhr.onload = function () {
|
||||
if (this.status === 200) {
|
||||
var filename = "";
|
||||
var disposition = xhr.getResponseHeader('Content-Disposition');
|
||||
if (disposition && disposition.indexOf('attachment') !== -1) {
|
||||
var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
|
||||
var matches = filenameRegex.exec(disposition);
|
||||
if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
|
||||
}
|
||||
var type = xhr.getResponseHeader('Content-Type');
|
||||
|
||||
var blob = new Blob([this.response], {type: type});
|
||||
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
||||
// IE workaround for "HTML7007: One or more blob URLs were revoked by closing the blob for which they were created. These URLs will no longer resolve as the data backing the URL has been freed."
|
||||
window.navigator.msSaveBlob(blob, filename);
|
||||
} else {
|
||||
var URL = window.URL || window.webkitURL;
|
||||
var downloadUrl = URL.createObjectURL(blob);
|
||||
|
||||
if (filename) {
|
||||
// use HTML5 a[download] attribute to specify filename
|
||||
var a = document.createElement("a");
|
||||
// safari doesn't support this yet
|
||||
if (typeof a.download === 'undefined') {
|
||||
window.location = downloadUrl;
|
||||
} else {
|
||||
a.href = downloadUrl;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
}
|
||||
} else {
|
||||
window.location = downloadUrl;
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
URL.revokeObjectURL(downloadUrl);
|
||||
}, 100); // cleanup
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||
xhr.send($.param(params));
|
||||
};
|
||||
|
||||
var _buildUrl = function(dt, action) {
|
||||
var url = dt.ajax.url() || '';
|
||||
var params = dt.ajax.params();
|
||||
params.action = action;
|
||||
|
||||
if (url.indexOf('?') > -1) {
|
||||
return url + '&' + $.param(params);
|
||||
}
|
||||
|
||||
return url + '?' + $.param(params);
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.excel = {
|
||||
className: 'buttons-excel',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-file-excel-o"></i> ' + dt.i18n('buttons.excel', 'Excel');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = _buildUrl(dt, 'excel');
|
||||
window.location = url;
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.postExcel = {
|
||||
className: 'buttons-excel',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-file-excel-o"></i> ' + dt.i18n('buttons.excel', 'Excel');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = dt.ajax.url() || window.location.href;
|
||||
var params = _buildParams(dt, 'excel');
|
||||
|
||||
_downloadFromUrl(url, params);
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.postExcelVisibleColumns = {
|
||||
className: 'buttons-excel',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-file-excel-o"></i> ' + dt.i18n('buttons.excel', 'Excel (only visible columns)');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = dt.ajax.url() || window.location.href;
|
||||
var params = _buildParams(dt, 'excel', true);
|
||||
|
||||
_downloadFromUrl(url, params);
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.export = {
|
||||
extend: 'collection',
|
||||
|
||||
className: 'buttons-export',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-download"></i> ' + dt.i18n('buttons.export', 'Export') + ' <span class="caret"/>';
|
||||
},
|
||||
|
||||
buttons: ['csv', 'excel', 'pdf']
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.csv = {
|
||||
className: 'buttons-csv',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-file-excel-o"></i> ' + dt.i18n('buttons.csv', 'CSV');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = _buildUrl(dt, 'csv');
|
||||
window.location = url;
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.postCsvVisibleColumns = {
|
||||
className: 'buttons-csv',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-file-excel-o"></i> ' + dt.i18n('buttons.csv', 'CSV (only visible columns)');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = dt.ajax.url() || window.location.href;
|
||||
var params = _buildParams(dt, 'csv', true);
|
||||
|
||||
_downloadFromUrl(url, params);
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.postCsv = {
|
||||
className: 'buttons-csv',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-file-excel-o"></i> ' + dt.i18n('buttons.csv', 'CSV');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = dt.ajax.url() || window.location.href;
|
||||
var params = _buildParams(dt, 'csv');
|
||||
|
||||
_downloadFromUrl(url, params);
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.pdf = {
|
||||
className: 'buttons-pdf',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-file-pdf-o"></i> ' + dt.i18n('buttons.pdf', 'PDF');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = _buildUrl(dt, 'pdf');
|
||||
window.location = url;
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.postPdf = {
|
||||
className: 'buttons-pdf',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-file-pdf-o"></i> ' + dt.i18n('buttons.pdf', 'PDF');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = dt.ajax.url() || window.location.href;
|
||||
var params = _buildParams(dt, 'pdf');
|
||||
|
||||
_downloadFromUrl(url, params);
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.print = {
|
||||
className: 'buttons-print',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-print"></i> ' + dt.i18n('buttons.print', 'Print');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
var url = _buildUrl(dt, 'print');
|
||||
window.location = url;
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.reset = {
|
||||
className: 'buttons-reset',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-undo"></i> ' + dt.i18n('buttons.reset', 'Reset');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
dt.search('');
|
||||
dt.columns().search('');
|
||||
dt.draw();
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.reload = {
|
||||
className: 'buttons-reload',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-refresh"></i> ' + dt.i18n('buttons.reload', 'Reload');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
dt.draw(false);
|
||||
}
|
||||
};
|
||||
|
||||
DataTable.ext.buttons.create = {
|
||||
className: 'buttons-create',
|
||||
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-plus"></i> ' + dt.i18n('buttons.create', 'Create');
|
||||
},
|
||||
|
||||
action: function (e, dt, button, config) {
|
||||
window.location = window.location.href.replace(/\/+$/, "") + '/create';
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof DataTable.ext.buttons.copyHtml5 !== 'undefined') {
|
||||
$.extend(DataTable.ext.buttons.copyHtml5, {
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-copy"></i> ' + dt.i18n('buttons.copy', 'Copy');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof DataTable.ext.buttons.colvis !== 'undefined') {
|
||||
$.extend(DataTable.ext.buttons.colvis, {
|
||||
text: function (dt) {
|
||||
return '<i class="fa fa-eye"></i> ' + dt.i18n('buttons.colvis', 'Column visibility');
|
||||
}
|
||||
});
|
||||
}
|
||||
})(jQuery, jQuery.fn.dataTable);
|
||||
37
vendor/yajra/laravel-datatables-buttons/src/resources/views/print.blade.php
vendored
Normal file
37
vendor/yajra/laravel-datatables-buttons/src/resources/views/print.blade.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Print Table</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name=description content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
|
||||
<style>
|
||||
body {margin: 20px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="table table-bordered table-condensed table-striped">
|
||||
@foreach($data as $row)
|
||||
@if ($loop->first)
|
||||
<tr>
|
||||
@foreach($row as $key => $value)
|
||||
<th>{!! $key !!}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
@foreach($row as $key => $value)
|
||||
@if(is_string($value) || is_numeric($value))
|
||||
<td>{!! $value !!}</td>
|
||||
@else
|
||||
<td></td>
|
||||
@endif
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
101
vendor/yajra/laravel-datatables-html/CHANGELOG.md
vendored
Normal file
101
vendor/yajra/laravel-datatables-html/CHANGELOG.md
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
# Laravel DataTables Html Plugin.
|
||||
|
||||
[](https://packagist.org/packages/yajra/laravel-datatables-html)
|
||||
[](https://packagist.org/packages/yajra/laravel-datatables-html)
|
||||
[](https://travis-ci.org/yajra/laravel-datatables-html)
|
||||
[](https://packagist.org/packages/yajra/laravel-datatables-html)
|
||||
[](https://packagist.org/packages/yajra/laravel-datatables-html)
|
||||
|
||||
## CHANGELOG
|
||||
|
||||
### v10.12.0 - 2023-12-15
|
||||
|
||||
- feat: allow macro on Field #213
|
||||
|
||||
### v10.11.0 - 2023-11-06
|
||||
|
||||
- feat: add batch remove optimization script (optional) #212
|
||||
|
||||
### v10.10.0 - 2023-11-04
|
||||
|
||||
- feat: Add optional scout js script #210
|
||||
- feat: add script support when using editor #211
|
||||
|
||||
### v10.9.1 - 2023-10-04
|
||||
|
||||
- fix: add missing Arrayable param #208
|
||||
- fix phpstan error: Parameter #1 $value of method Yajra\DataTables\Html\Builder::searchPanes() expects array|bool|(callable(): mixed), Yajra\DataTables\Html\SearchPane given.
|
||||
|
||||
### v10.9.0 - 2023-10-02
|
||||
|
||||
- feat: add dtsp collapse option setter #206
|
||||
- feat: add initCollapsed option setter #207
|
||||
|
||||
### v10.8.2 - 2023-10-02
|
||||
|
||||
- fix: show searchPanes by default #205
|
||||
|
||||
### v10.8.1 - 2023-08-16
|
||||
|
||||
- Revert "fix: Mixed Content problem with updating minifiedAjax method and get current url based on http or https scheme" #202
|
||||
- Reverts #186
|
||||
- fix: #201
|
||||
|
||||
### v10.8.0 - 2023-07-31
|
||||
|
||||
- fix: Mixed Content problem with updating minifiedAjax method and get current url based on http or https scheme #186
|
||||
- fix: #194
|
||||
- feat: add exportRender method #195
|
||||
|
||||
### v10.7.0 - 2023-06-08
|
||||
|
||||
- feat: new method for enum options #196
|
||||
|
||||
### v10.6.0 - 2023-03-31
|
||||
|
||||
- feat: thead class builder #191
|
||||
- fix: #169
|
||||
- fix: [yajra/laravel-datatables#2706](https://github.com/yajra/laravel-datatables/issues/2706)
|
||||
|
||||
### v10.5.2 - 2023-03-31
|
||||
|
||||
- fix: backward compatibility with FormOptions class #190
|
||||
|
||||
### v10.5.1 - 2023-03-28
|
||||
|
||||
- fix: scripts attributes not working #189
|
||||
|
||||
### v10.5.0 - 2023-03-02
|
||||
|
||||
- feat: hide/show fields based on editor action #188
|
||||
- hiddenOnCreate
|
||||
- hiddenOnEdit
|
||||
- hiddenOn
|
||||
|
||||
### v10.4.0 - 2023-03-02
|
||||
|
||||
- feat: add datetime field options #187
|
||||
- wireFormat
|
||||
- keyInput
|
||||
- displayFormat
|
||||
|
||||
### v10.3.1 - 2023-02-20
|
||||
|
||||
- fix: too long file name check for column render #185
|
||||
|
||||
### v10.3.0 - 2023-02-20
|
||||
|
||||
- feat: add builder ability to use viteJs by default #184
|
||||
|
||||
### v10.2.0 - 2023-02-20
|
||||
|
||||
- feat: allow callable exportFormat parameter #167
|
||||
|
||||
### v10.1.0 - 2023-02-07
|
||||
|
||||
- Drop Collective\Html dependency #183
|
||||
- Copy Collective HtmlBuilder class and implemented php-stan
|
||||
|
||||
### v10.0.0 - 2023-02-07
|
||||
|
||||
- Add Laravel 10 specific support
|
||||
22
vendor/yajra/laravel-datatables-html/CONDUCT.md
vendored
Normal file
22
vendor/yajra/laravel-datatables-html/CONDUCT.md
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# Contributor Code of Conduct
|
||||
|
||||
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
||||
|
||||
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery
|
||||
* Personal attacks
|
||||
* Trolling or insulting/derogatory comments
|
||||
* Public or private harassment
|
||||
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
|
||||
* Other unethical or unprofessional conduct.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
|
||||
|
||||
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community in a direct capacity. Personal views, beliefs and values of individuals do not necessarily reflect those of the organisation or affiliated individuals and organisations.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
|
||||
22
vendor/yajra/laravel-datatables-html/LICENSE.md
vendored
Normal file
22
vendor/yajra/laravel-datatables-html/LICENSE.md
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013-2022 Arjay Angeles <aqangeles@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
79
vendor/yajra/laravel-datatables-html/README.md
vendored
Normal file
79
vendor/yajra/laravel-datatables-html/README.md
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
# Laravel DataTables Html Plugin.
|
||||
|
||||
[](http://laravel.com)
|
||||
[](https://packagist.org/packages/yajra/laravel-datatables-html)
|
||||

|
||||
[](https://scrutinizer-ci.com/g/yajra/laravel-datatables-html/?branch=master)
|
||||
[](https://packagist.org/packages/yajra/laravel-datatables-html)
|
||||
[](https://packagist.org/packages/yajra/laravel-datatables-html)
|
||||
|
||||
This package is a plugin of [Laravel DataTables](https://github.com/yajra/laravel-datatables) for generating dataTables script using PHP.
|
||||
|
||||
## Requirements
|
||||
|
||||
- [Laravel 10.x](https://github.com/laravel/framework)
|
||||
- [Laravel DataTables](https://github.com/yajra/laravel-datatables)
|
||||
|
||||
## Documentations
|
||||
|
||||
- [Laravel DataTables Documentation](http://yajrabox.com/docs/laravel-datatables)
|
||||
- [Demo Application](http://datatables.yajrabox.com) is available for artisan's reference.
|
||||
|
||||
## Laravel Version Compatibility
|
||||
|
||||
| Laravel | Package |
|
||||
|:--------------|:--------|
|
||||
| 8.x and below | 4.x |
|
||||
| 9.x | 9.x |
|
||||
| 10.x | 10.x |
|
||||
|
||||
## Quick Installation
|
||||
|
||||
`composer require yajra/laravel-datatables-html:^10`
|
||||
|
||||
#### Setup scripts with ViteJS
|
||||
|
||||
Set the default javascript type to `module` by setting `Builder::useVite()` in the `AppServiceProvider`.
|
||||
|
||||
```php
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Pagination\Paginator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Yajra\DataTables\Html\Builder;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Paginator::useBootstrapFive();
|
||||
Builder::useVite();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Publish Assets (Optional)
|
||||
|
||||
`$ php artisan vendor:publish --tag=datatables-html`
|
||||
|
||||
And that's it! Start building out some awesome DataTables!
|
||||
|
||||
## Contributing
|
||||
|
||||
Please see [CONTRIBUTING](https://github.com/yajra/laravel-datatables-html/blob/master/.github/CONTRIBUTING.md) for details.
|
||||
|
||||
## Security
|
||||
|
||||
If you discover any security related issues, please email [aqangeles@gmail.com](mailto:aqangeles@gmail.com) instead of using the issue tracker.
|
||||
|
||||
## Credits
|
||||
|
||||
- [Arjay Angeles](https://github.com/yajra)
|
||||
- [All Contributors](https://github.com/yajra/laravel-datatables-html/graphs/contributors)
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT). Please see [License File](https://github.com/yajra/laravel-datatables-html/blob/master/LICENSE.md) for more information.
|
||||
1
vendor/yajra/laravel-datatables-html/UPGRADE.md
vendored
Normal file
1
vendor/yajra/laravel-datatables-html/UPGRADE.md
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Upgrade Notes
|
||||
49
vendor/yajra/laravel-datatables-html/composer.json
vendored
Normal file
49
vendor/yajra/laravel-datatables-html/composer.json
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"name": "yajra/laravel-datatables-html",
|
||||
"description": "Laravel DataTables HTML builder plugin for Laravel 5.4+.",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"dataTables",
|
||||
"jquery",
|
||||
"html",
|
||||
"js"
|
||||
],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Arjay Angeles",
|
||||
"email": "aqangeles@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"ext-json": "*",
|
||||
"yajra/laravel-datatables-oracle": "^10.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"nunomaduro/larastan": "^2.4",
|
||||
"orchestra/testbench": "^7.21"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Yajra\\DataTables\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Yajra\\DataTables\\Html\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "10.0-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Yajra\\DataTables\\HtmlServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
17
vendor/yajra/laravel-datatables-html/phpunit.xml
vendored
Normal file
17
vendor/yajra/laravel-datatables-html/phpunit.xml
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Package Test Suite">
|
||||
<directory suffix=".php">./tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
||||
312
vendor/yajra/laravel-datatables-html/src/Html/Builder.php
vendored
Normal file
312
vendor/yajra/laravel-datatables-html/src/Html/Builder.php
vendored
Normal file
|
|
@ -0,0 +1,312 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html;
|
||||
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use Yajra\DataTables\Utilities\Helper;
|
||||
|
||||
class Builder
|
||||
{
|
||||
use Macroable;
|
||||
use HasOptions;
|
||||
use HasTable;
|
||||
use HasEditor;
|
||||
use Columns\Index;
|
||||
use Columns\Action;
|
||||
use Columns\Checkbox;
|
||||
|
||||
// Select plugin constants.
|
||||
const SELECT_STYLE_API = 'api';
|
||||
const SELECT_STYLE_SINGLE = 'single';
|
||||
const SELECT_STYLE_MULTI = 'multi';
|
||||
const SELECT_STYLE_OS = 'os';
|
||||
const SELECT_STYLE_MULTI_SHIFT = 'multi+shift';
|
||||
const SELECT_ITEMS_ROW = 'row';
|
||||
const SELECT_ITEMS_COLUMN = 'column';
|
||||
const SELECT_ITEMS_CELL = 'cell';
|
||||
|
||||
/**
|
||||
* The default type to use for the DataTables javascript.
|
||||
*/
|
||||
protected static string $jsType = 'text/javascript';
|
||||
|
||||
/**
|
||||
* @var Collection<int, \Yajra\DataTables\Html\Column>
|
||||
*/
|
||||
public Collection $collection;
|
||||
|
||||
/**
|
||||
* @var array<string, string|null>
|
||||
*/
|
||||
protected array $tableAttributes = [];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected string $template = '';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected array $attributes = [];
|
||||
|
||||
/**
|
||||
* @var string|array
|
||||
*/
|
||||
protected string|array $ajax = '';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected array $additionalScripts = [];
|
||||
|
||||
/**
|
||||
* @param Repository $config
|
||||
* @param Factory $view
|
||||
* @param HtmlBuilder $html
|
||||
*/
|
||||
public function __construct(public Repository $config, public Factory $view, public HtmlBuilder $html)
|
||||
{
|
||||
/** @var array $defaults */
|
||||
$defaults = $this->config->get('datatables-html.table', []);
|
||||
|
||||
$this->collection = new Collection;
|
||||
$this->tableAttributes = $defaults;
|
||||
$this->attributes = [
|
||||
'serverSide' => true,
|
||||
'processing' => true,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default type to module for the DataTables javascript.
|
||||
*/
|
||||
public static function useVite(): void
|
||||
{
|
||||
static::$jsType = 'module';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default type to text/javascript for the DataTables javascript.
|
||||
*/
|
||||
public static function useWebpack(): void
|
||||
{
|
||||
static::$jsType = 'text/javascript';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate DataTable javascript.
|
||||
*
|
||||
* @param string|null $script
|
||||
* @param array $attributes
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function scripts(string $script = null, array $attributes = []): HtmlString
|
||||
{
|
||||
$script = $script ?: $this->generateScripts();
|
||||
$attributes = $this->html->attributes(
|
||||
array_merge($attributes, ['type' => $attributes['type'] ?? static::$jsType])
|
||||
);
|
||||
|
||||
return new HtmlString("<script{$attributes}>$script</script>");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get generated raw scripts.
|
||||
*
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function generateScripts(): HtmlString
|
||||
{
|
||||
$parameters = $this->generateJson();
|
||||
|
||||
return new HtmlString(
|
||||
trim(sprintf($this->template(), $this->getTableAttribute('id'), $parameters))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get generated json configuration.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generateJson(): string
|
||||
{
|
||||
return $this->parameterize($this->getOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate DataTables js parameters.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @return string
|
||||
*/
|
||||
public function parameterize(array $attributes = []): string
|
||||
{
|
||||
$parameters = (new Parameters($attributes))->toArray();
|
||||
|
||||
return Helper::toJsonScript($parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get DataTable options array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions(): array
|
||||
{
|
||||
return array_merge(
|
||||
$this->attributes, [
|
||||
'ajax' => $this->ajax,
|
||||
'columns' => $this->collection->map(function (Column $column) {
|
||||
$column = $column->toArray();
|
||||
unset($column['attributes']);
|
||||
|
||||
return $column;
|
||||
})->toArray(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get javascript template to use.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function template(): string
|
||||
{
|
||||
/** @var view-string $configTemplate */
|
||||
$configTemplate = $this->config->get('datatables-html.script', 'datatables::script');
|
||||
|
||||
$template = $this->template ?: $configTemplate;
|
||||
|
||||
return $this->view->make($template, ['editors' => $this->editors, 'scripts' => $this->additionalScripts])->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate DataTable's table html.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @param bool $drawFooter
|
||||
* @param bool $drawSearch
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function table(array $attributes = [], bool $drawFooter = false, bool $drawSearch = false): HtmlString
|
||||
{
|
||||
$this->setTableAttributes($attributes);
|
||||
|
||||
$th = $this->compileTableHeaders();
|
||||
$htmlAttr = $this->html->attributes($this->tableAttributes);
|
||||
|
||||
$tableHtml = '<table'.$htmlAttr.'>';
|
||||
$searchHtml = $drawSearch
|
||||
? '<tr class="search-filter">'.implode('', $this->compileTableSearchHeaders()).'</tr>'
|
||||
: '';
|
||||
|
||||
$tableHtml .= '<thead'.($this->theadClass ?? '').'>';
|
||||
$tableHtml .= '<tr>'.implode('', $th).'</tr>'.$searchHtml.'</thead>';
|
||||
|
||||
if ($drawFooter) {
|
||||
$tf = $this->compileTableFooter();
|
||||
$tableHtml .= '<tfoot><tr>'.implode('', $tf).'</tr></tfoot>';
|
||||
}
|
||||
|
||||
$tableHtml .= '</table>';
|
||||
|
||||
return new HtmlString($tableHtml);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure DataTable's parameters.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @return $this
|
||||
*/
|
||||
public function parameters(array $attributes = []): static
|
||||
{
|
||||
$this->attributes = array_merge($this->attributes, $attributes);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate scripts that set the dataTables options into a variable.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function asOptions(): static
|
||||
{
|
||||
return $this->setTemplate('datatables::options');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set custom javascript template.
|
||||
*
|
||||
* @param string $template
|
||||
* @return $this
|
||||
*/
|
||||
public function setTemplate(string $template): static
|
||||
{
|
||||
$this->template = $template;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap dataTable scripts with a function.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function asFunction(): static
|
||||
{
|
||||
return $this->setTemplate('datatables::function');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getAttributes(): array
|
||||
{
|
||||
return $this->attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAttribute(string $key, mixed $default = ''): mixed
|
||||
{
|
||||
return $this->attributes[$key] ?? $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $key
|
||||
* @return array|string
|
||||
*/
|
||||
public function getAjax(string $key = null): array|string
|
||||
{
|
||||
if (! is_null($key)) {
|
||||
return $this->ajax[$key] ?? '';
|
||||
}
|
||||
|
||||
return $this->ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add additional scripts to the DataTables JS initialization.
|
||||
*
|
||||
* @param string $view
|
||||
* @return $this
|
||||
*/
|
||||
public function addScript(string $view): static
|
||||
{
|
||||
$this->additionalScripts[] = $view;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
445
vendor/yajra/laravel-datatables-html/src/Html/Button.php
vendored
Executable file
445
vendor/yajra/laravel-datatables-html/src/Html/Button.php
vendored
Executable file
|
|
@ -0,0 +1,445 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html;
|
||||
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Support\Fluent;
|
||||
|
||||
class Button extends Fluent implements Arrayable
|
||||
{
|
||||
use HasAuthorizations;
|
||||
|
||||
/**
|
||||
* Make a new button instance.
|
||||
*
|
||||
* @param array|string $options
|
||||
* @return static
|
||||
*/
|
||||
public static function make(array|string $options = []): static
|
||||
{
|
||||
if (is_string($options)) {
|
||||
return new static(['extend' => $options]);
|
||||
}
|
||||
|
||||
return new static($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a raw button that does not extend anything.
|
||||
*
|
||||
* @param array|string $options
|
||||
* @return static
|
||||
*/
|
||||
public static function raw(array|string $options = []): static
|
||||
{
|
||||
if (is_string($options)) {
|
||||
return new static(['text' => $options]);
|
||||
}
|
||||
|
||||
return new static($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set attr option value.
|
||||
*
|
||||
* @param array $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/buttons.buttons.attr
|
||||
*/
|
||||
public function attr(array $value): static
|
||||
{
|
||||
$this->attributes['attr'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set available option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/buttons.buttons.available
|
||||
*/
|
||||
public function available(string $value): static
|
||||
{
|
||||
if ($this->isFunction($value)) {
|
||||
$this->attributes['available'] = $value;
|
||||
} else {
|
||||
$this->attributes['available'] = "function(dt, config) { $value }";
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given value is a function.
|
||||
*
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function isFunction(string $value): bool
|
||||
{
|
||||
return str_starts_with($value, 'function');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set enabled option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/buttons.buttons.enabled
|
||||
*/
|
||||
public function enabled(bool $value = true): static
|
||||
{
|
||||
$this->attributes['enabled'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set init option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/buttons.buttons.init
|
||||
*/
|
||||
public function init(string $value): static
|
||||
{
|
||||
if ($this->isFunction($value)) {
|
||||
$this->attributes['init'] = $value;
|
||||
} else {
|
||||
$this->attributes['init'] = "function(dt, node, config) { $value }";
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set key option value.
|
||||
*
|
||||
* @param array|string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/buttons.buttons.key
|
||||
*/
|
||||
public function key(array|string $value): static
|
||||
{
|
||||
$this->attributes['key'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extend option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/buttons.buttons.extend
|
||||
*/
|
||||
public function extend(string $value): static
|
||||
{
|
||||
$this->attributes['extend'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set editor option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/button
|
||||
*/
|
||||
public function editor(string $value): static
|
||||
{
|
||||
$this->attributes['editor'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set buttons option value.
|
||||
*
|
||||
* @param array $buttons
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/buttons.buttons
|
||||
*/
|
||||
public function buttons(array $buttons): static
|
||||
{
|
||||
foreach ($buttons as $key => $button) {
|
||||
if ($button instanceof Arrayable) {
|
||||
$buttons[$key] = $button->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
$this->attributes['buttons'] = $buttons;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $buttons
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/examples/api/cancelButton
|
||||
*/
|
||||
public function formButtons(array $buttons): static
|
||||
{
|
||||
foreach ($buttons as $key => $button) {
|
||||
if ($button instanceof Arrayable) {
|
||||
$buttons[$key] = $button->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
$this->attributes['formButtons'] = $buttons;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/examples/api/removeMessage
|
||||
* @see https://editor.datatables.net/reference/button/create
|
||||
* @see https://editor.datatables.net/reference/button/edit
|
||||
* @see https://editor.datatables.net/reference/button/remove
|
||||
*/
|
||||
public function formMessage(string $message): static
|
||||
{
|
||||
$this->attributes['formMessage'] = $message;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $title
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/button/create
|
||||
* @see https://editor.datatables.net/reference/button/edit
|
||||
* @see https://editor.datatables.net/reference/button/remove
|
||||
*/
|
||||
public function formTitle(string $title): static
|
||||
{
|
||||
$this->attributes['formTitle'] = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set className option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/buttons.buttons.className
|
||||
*/
|
||||
public function className(string $value): static
|
||||
{
|
||||
$this->attributes['className'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set destroy option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/buttons.buttons.destroy
|
||||
*/
|
||||
public function destroy(string $value): static
|
||||
{
|
||||
if ($this->isFunction($value)) {
|
||||
$this->attributes['destroy'] = $value;
|
||||
} else {
|
||||
$this->attributes['destroy'] = "function(dt, node, config) { $value }";
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set customize option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/button/excelHtml5
|
||||
*/
|
||||
public function customize(string $value): static
|
||||
{
|
||||
$this->attributes['customize'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a class name to column.
|
||||
*
|
||||
* @param string $class
|
||||
* @return $this
|
||||
*/
|
||||
public function addClass(string $class): static
|
||||
{
|
||||
if (! isset($this->attributes['className'])) {
|
||||
$this->attributes['className'] = $class;
|
||||
} else {
|
||||
$this->attributes['className'] .= " $class";
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set text option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/buttons.buttons.text
|
||||
*/
|
||||
public function text(string $value): static
|
||||
{
|
||||
$this->attributes['text'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set titleAttr option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/buttons.buttons.titleAttr
|
||||
*/
|
||||
public function titleAttr(string $value): static
|
||||
{
|
||||
$this->attributes['titleAttr'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/buttons.buttons.name
|
||||
*/
|
||||
public function name(string $value): static
|
||||
{
|
||||
$this->attributes['name'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set namespace option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/buttons.buttons.namespace
|
||||
*/
|
||||
public function namespace(string $value): static
|
||||
{
|
||||
$this->attributes['namespace'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set tag option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/buttons.buttons.tag
|
||||
*/
|
||||
public function tag(string $value): static
|
||||
{
|
||||
$this->attributes['tag'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set columns option value.
|
||||
*
|
||||
* @param array|string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function columns(array|string $value): static
|
||||
{
|
||||
$this->attributes['columns'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set exportOptions option value.
|
||||
*
|
||||
* @param array|string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function exportOptions(array|string $value): static
|
||||
{
|
||||
$this->attributes['exportOptions'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set action to submit the form.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function actionSubmit(): static
|
||||
{
|
||||
return $this->action('function() { this.submit(); }');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set action option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function action(string $value): static
|
||||
{
|
||||
if (str_starts_with($value, 'function')) {
|
||||
$this->attributes['action'] = $value;
|
||||
} else {
|
||||
$this->attributes['action'] = "function(e, dt, node, config) { $value }";
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set editor class action handler.
|
||||
*
|
||||
* @param string $action
|
||||
* @return $this
|
||||
*/
|
||||
public function actionHandler(string $action): static
|
||||
{
|
||||
return $this->action("function() { this.submit(null, null, function(data) { data.action = '{$action}'; return data; }) }");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set action to close the form.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function actionClose(): static
|
||||
{
|
||||
return $this->action('function() { this.close(); }');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set button alignment.
|
||||
*
|
||||
* @param string $align
|
||||
* @return $this
|
||||
*/
|
||||
public function align(string $align = 'button-left'): static
|
||||
{
|
||||
$this->attributes['align'] = $align;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
631
vendor/yajra/laravel-datatables-html/src/Html/Column.php
vendored
Normal file
631
vendor/yajra/laravel-datatables-html/src/Html/Column.php
vendored
Normal file
|
|
@ -0,0 +1,631 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Fluent;
|
||||
use Illuminate\Support\Str;
|
||||
use Yajra\DataTables\Html\Options\Plugins\SearchPanes;
|
||||
|
||||
/**
|
||||
* @property array|string $data
|
||||
* @property string $name
|
||||
* @property string $title
|
||||
* @property string $titleAttr
|
||||
* @property bool $orderable
|
||||
* @property bool $searchable
|
||||
* @property bool $printable
|
||||
* @property bool $exportable
|
||||
* @property array|string $footer
|
||||
* @property array $attributes
|
||||
* @property string $render
|
||||
* @property string $className
|
||||
* @property string $editField
|
||||
* @property int|array $orderData
|
||||
* @property string $orderDataType
|
||||
* @property string $orderSequence
|
||||
* @property string $cellType
|
||||
* @property string $type
|
||||
* @property string $contentPadding
|
||||
* @property string $createdCell
|
||||
* @property string $exportFormat
|
||||
* @see https://datatables.net/reference/option/#columns
|
||||
*/
|
||||
class Column extends Fluent
|
||||
{
|
||||
use SearchPanes;
|
||||
use HasAuthorizations;
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
public function __construct($attributes = [])
|
||||
{
|
||||
$attributes['title'] ??= self::titleFormat($attributes['data'] ?? '');
|
||||
$attributes['orderable'] ??= true;
|
||||
$attributes['searchable'] ??= true;
|
||||
$attributes['exportable'] ??= true;
|
||||
$attributes['printable'] ??= true;
|
||||
$attributes['footer'] ??= '';
|
||||
$attributes['attributes'] ??= [];
|
||||
|
||||
// Allow methods override attribute value
|
||||
foreach ($attributes as $attribute => $value) {
|
||||
$method = 'parse'.ucfirst(strtolower($attribute));
|
||||
if (! is_null($value) && method_exists($this, $method)) {
|
||||
$attributes[$attribute] = $this->$method($value);
|
||||
}
|
||||
}
|
||||
|
||||
if (! isset($attributes['name']) && isset($attributes['data'])) {
|
||||
$attributes['name'] = $attributes['data'];
|
||||
}
|
||||
|
||||
parent::__construct($attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format string to title case.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function titleFormat(string $value): string
|
||||
{
|
||||
return Str::title(str_replace(['.', '_'], ' ', Str::snake($value)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column title.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.title
|
||||
*/
|
||||
public function title(string $value): static
|
||||
{
|
||||
$this->attributes['title'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a computed column that is not searchable/orderable.
|
||||
*
|
||||
* @param string $data
|
||||
* @param string|null $title
|
||||
* @return Column
|
||||
*/
|
||||
public static function computed(string $data, string $title = null): Column
|
||||
{
|
||||
if (is_null($title)) {
|
||||
$title = self::titleFormat($data);
|
||||
}
|
||||
|
||||
return static::make($data)->title($title)->orderable(false)->searchable(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column searchable flag.
|
||||
*
|
||||
* @param bool $flag
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.searchable
|
||||
*/
|
||||
public function searchable(bool $flag = true): static
|
||||
{
|
||||
$this->attributes['searchable'] = $flag;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column orderable flag.
|
||||
*
|
||||
* @param bool $flag
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.orderable
|
||||
*/
|
||||
public function orderable(bool $flag = true): static
|
||||
{
|
||||
$this->attributes['orderable'] = $flag;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a new column instance.
|
||||
*
|
||||
* @param array|string $data
|
||||
* @param string $name
|
||||
* @return static
|
||||
*/
|
||||
public static function make(array|string $data = [], string $name = ''): static
|
||||
{
|
||||
$attr = $data;
|
||||
if (is_string($data)) {
|
||||
$attr = [
|
||||
'data' => $data,
|
||||
'name' => $name ?: $data,
|
||||
];
|
||||
}
|
||||
|
||||
return new static($attr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a new formatted column instance.
|
||||
*
|
||||
* @param string $name
|
||||
* @return static
|
||||
*/
|
||||
public static function formatted(string $name): static
|
||||
{
|
||||
$attr = [
|
||||
'data' => $name,
|
||||
'name' => $name,
|
||||
'title' => self::titleFormat($name),
|
||||
'render' => 'full.'.$name.'_formatted',
|
||||
];
|
||||
|
||||
return new static($attr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a checkbox column.
|
||||
*
|
||||
* @param string $title
|
||||
* @return static
|
||||
*/
|
||||
public static function checkbox(string $title = ''): static
|
||||
{
|
||||
return static::make('')
|
||||
->content('')
|
||||
->title($title)
|
||||
->className('select-checkbox')
|
||||
->orderable(false)
|
||||
->exportable(false)
|
||||
->searchable(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column exportable flag.
|
||||
*
|
||||
* @param bool $flag
|
||||
* @return $this
|
||||
*/
|
||||
public function exportable(bool $flag = true): static
|
||||
{
|
||||
$this->attributes['exportable'] = $flag;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column class name.
|
||||
*
|
||||
* @param string $class
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.className
|
||||
*/
|
||||
public function className(string $class): static
|
||||
{
|
||||
$this->attributes['className'] = $class;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column default content.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.defaultContent
|
||||
*/
|
||||
public function content(string $value): static
|
||||
{
|
||||
$this->attributes['defaultContent'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column responsive priority.
|
||||
*
|
||||
* @param int|string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.responsivePriority
|
||||
*/
|
||||
public function responsivePriority(int|string $value): static
|
||||
{
|
||||
$this->attributes['responsivePriority'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column hidden state.
|
||||
*
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.visible
|
||||
*/
|
||||
public function hidden(): static
|
||||
{
|
||||
return $this->visible(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column visible flag.
|
||||
*
|
||||
* @param bool $flag
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.visible
|
||||
*/
|
||||
public function visible(bool $flag = true): static
|
||||
{
|
||||
$this->attributes['visible'] = $flag;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a class name to field.
|
||||
*
|
||||
* @param string $class
|
||||
* @return $this
|
||||
*/
|
||||
public function addClass(string $class): static
|
||||
{
|
||||
if (! isset($this->attributes['className'])) {
|
||||
$this->attributes['className'] = $class;
|
||||
} else {
|
||||
$this->attributes['className'] .= " $class";
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column printable flag.
|
||||
*
|
||||
* @param bool $flag
|
||||
* @return $this
|
||||
*/
|
||||
public function printable(bool $flag = true): static
|
||||
{
|
||||
$this->attributes['printable'] = $flag;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column width value.
|
||||
*
|
||||
* @param int|string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.width
|
||||
*/
|
||||
public function width(int|string $value): static
|
||||
{
|
||||
$this->attributes['width'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column data option value.
|
||||
*
|
||||
* @param array|string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.data
|
||||
* @see https://datatables.net/manual/data/orthogonal-data
|
||||
*/
|
||||
public function data(array|string $value): static
|
||||
{
|
||||
$this->attributes['data'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column name option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.name
|
||||
*/
|
||||
public function name(string $value): static
|
||||
{
|
||||
$this->attributes['name'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column edit field option value.
|
||||
*
|
||||
* @param array|string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.editField
|
||||
*/
|
||||
public function editField(array|string $value): static
|
||||
{
|
||||
$this->attributes['editField'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column orderData option value.
|
||||
*
|
||||
* @param array|int $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.orderData
|
||||
*/
|
||||
public function orderData(array|int $value): static
|
||||
{
|
||||
$this->attributes['orderData'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column orderDataType option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.orderDataType
|
||||
*/
|
||||
public function orderDataType(string $value): static
|
||||
{
|
||||
$this->attributes['orderDataType'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column orderSequence option value.
|
||||
*
|
||||
* @param array $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.orderSequence
|
||||
*/
|
||||
public function orderSequence(array $value): static
|
||||
{
|
||||
$this->attributes['orderSequence'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column cellType option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.cellType
|
||||
*/
|
||||
public function cellType(string $value = 'th'): static
|
||||
{
|
||||
$this->attributes['cellType'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column type option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.type
|
||||
*/
|
||||
public function type(string $value): static
|
||||
{
|
||||
$this->attributes['type'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column contentPadding option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.contentPadding
|
||||
*/
|
||||
public function contentPadding(string $value): static
|
||||
{
|
||||
$this->attributes['contentPadding'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column createdCell option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.createdCell
|
||||
*/
|
||||
public function createdCell(string $value): static
|
||||
{
|
||||
$this->attributes['createdCell'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the js renderer "$.fn.dataTable.render.".
|
||||
*
|
||||
* @param string $value
|
||||
* @param int|string|null ...$params
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.render
|
||||
*/
|
||||
public function renderJs(string $value, ...$params): static
|
||||
{
|
||||
if ($params) {
|
||||
$value .= '(';
|
||||
foreach ($params as $param) {
|
||||
$value .= sprintf("'%s',", $param);
|
||||
}
|
||||
$value = mb_substr($value, 0, -1);
|
||||
$value .= ')';
|
||||
}
|
||||
|
||||
$renderer = '$.fn.dataTable.render.'.$value;
|
||||
|
||||
return $this->render($renderer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column renderer.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.render
|
||||
*/
|
||||
public function render(mixed $value): static
|
||||
{
|
||||
$this->attributes['render'] = $this->parseRender($value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Callback function to render column for Print + Export
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
|
||||
*/
|
||||
public function exportRender(callable $callback): static
|
||||
{
|
||||
$this->attributes['exportRender'] = $callback;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse render attribute.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return string|null
|
||||
*/
|
||||
public function parseRender(mixed $value): ?string
|
||||
{
|
||||
/** @var \Illuminate\Contracts\View\Factory $view */
|
||||
$view = app('view');
|
||||
$parameters = [];
|
||||
|
||||
if (is_array($value)) {
|
||||
$parameters = Arr::except($value, 0);
|
||||
$value = $value[0];
|
||||
}
|
||||
|
||||
if (is_callable($value)) {
|
||||
return $value($parameters);
|
||||
} elseif ($this->isBuiltInRenderFunction($value)) {
|
||||
return $value;
|
||||
} elseif (strlen($value) < 256 && $view->exists($value)) {
|
||||
return $view->make($value)->with($parameters)->render();
|
||||
}
|
||||
|
||||
return $value ? $this->parseRenderAsString($value) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if given key & value is a valid datatables built-in renderer function.
|
||||
*
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
private function isBuiltInRenderFunction(string $value): bool
|
||||
{
|
||||
if (empty($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Str::startsWith(trim($value), ['$.fn.dataTable.render', '[']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display render value as is.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
private function parseRenderAsString(string $value): string
|
||||
{
|
||||
return "function(data,type,full,meta){return $value;}";
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column renderer with give raw value.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns.render
|
||||
*/
|
||||
public function renderRaw(mixed $value): static
|
||||
{
|
||||
$this->attributes['render'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column footer.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
*/
|
||||
public function footer(mixed $value): static
|
||||
{
|
||||
$this->attributes['footer'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set custom html title instead default label.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
*/
|
||||
public function titleAttr(mixed $value): static
|
||||
{
|
||||
$this->attributes['titleAttr'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set excel column format when exporting.
|
||||
*
|
||||
* @param string|callable $format
|
||||
* @return $this
|
||||
* @see https://github.com/yajra/laravel-datatables-export
|
||||
*/
|
||||
public function exportFormat(string|callable $format): static
|
||||
{
|
||||
$this->attributes['exportFormat'] = $format;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
if (! $this->isAuthorized()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Arr::except($this->attributes, [
|
||||
'printable',
|
||||
'exportable',
|
||||
'footer',
|
||||
]);
|
||||
}
|
||||
}
|
||||
55
vendor/yajra/laravel-datatables-html/src/Html/ColumnDefinition.php
vendored
Normal file
55
vendor/yajra/laravel-datatables-html/src/Html/ColumnDefinition.php
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html;
|
||||
|
||||
/**
|
||||
* @see https://datatables.net/reference/option/columnDefs
|
||||
*/
|
||||
class ColumnDefinition extends Column
|
||||
{
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
public function __construct($attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
|
||||
$this->attributes = $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|string|int $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columnDefs.targets
|
||||
*/
|
||||
public function targets(array|string|int $value): static
|
||||
{
|
||||
$this->attributes['targets'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns
|
||||
*/
|
||||
public function columns(array $value): static
|
||||
{
|
||||
$this->attributes['columns'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
$array = parent::toArray();
|
||||
|
||||
unset($array['attributes']);
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
10
vendor/yajra/laravel-datatables-html/src/Html/ColumnDefinitions.php
vendored
Normal file
10
vendor/yajra/laravel-datatables-html/src/Html/ColumnDefinitions.php
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class ColumnDefinitions extends Collection
|
||||
{
|
||||
|
||||
}
|
||||
39
vendor/yajra/laravel-datatables-html/src/Html/Columns/Action.php
vendored
Normal file
39
vendor/yajra/laravel-datatables-html/src/Html/Columns/Action.php
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Columns;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
trait Action
|
||||
{
|
||||
/**
|
||||
* Add an action column.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @param bool $prepend
|
||||
* @return $this
|
||||
*/
|
||||
public function addAction(array $attributes = [], bool $prepend = false): static
|
||||
{
|
||||
$attributes = array_merge([
|
||||
'defaultContent' => '',
|
||||
'data' => 'action',
|
||||
'name' => 'action',
|
||||
'title' => 'Action',
|
||||
'render' => null,
|
||||
'orderable' => false,
|
||||
'searchable' => false,
|
||||
'exportable' => false,
|
||||
'printable' => true,
|
||||
'footer' => '',
|
||||
], $attributes);
|
||||
|
||||
if ($prepend) {
|
||||
$this->collection->prepend(new Column($attributes));
|
||||
} else {
|
||||
$this->collection->push(new Column($attributes));
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
42
vendor/yajra/laravel-datatables-html/src/Html/Columns/Checkbox.php
vendored
Normal file
42
vendor/yajra/laravel-datatables-html/src/Html/Columns/Checkbox.php
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Columns;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
trait Checkbox
|
||||
{
|
||||
/**
|
||||
* Add a checkbox column.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @param bool|int $position true to prepend, false to append or a zero-based index for positioning
|
||||
* @return $this
|
||||
*/
|
||||
public function addCheckbox(array $attributes = [], bool|int $position = false): static
|
||||
{
|
||||
$attributes = array_merge([
|
||||
'defaultContent' => '<input type="checkbox" '.$this->html->attributes($attributes).'/>',
|
||||
'title' => '<input type="checkbox" '.$this->html->attributes($attributes + ['id' => 'dataTablesCheckbox']).'/>',
|
||||
'data' => 'checkbox',
|
||||
'name' => 'checkbox',
|
||||
'orderable' => false,
|
||||
'searchable' => false,
|
||||
'exportable' => false,
|
||||
'printable' => true,
|
||||
'width' => '10px',
|
||||
], $attributes);
|
||||
|
||||
$column = new Column($attributes);
|
||||
|
||||
if ($position === true) {
|
||||
$this->collection->prepend($column);
|
||||
} elseif ($position === false || $position >= $this->collection->count()) {
|
||||
$this->collection->push($column);
|
||||
} else {
|
||||
$this->collection->splice($position, 0, [$column]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
36
vendor/yajra/laravel-datatables-html/src/Html/Columns/Index.php
vendored
Normal file
36
vendor/yajra/laravel-datatables-html/src/Html/Columns/Index.php
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Columns;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
trait Index
|
||||
{
|
||||
/**
|
||||
* Add a index column.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @return $this
|
||||
*/
|
||||
public function addIndex(array $attributes = []): static
|
||||
{
|
||||
$indexColumn = $this->config->get('datatables.index_column', 'DT_RowIndex');
|
||||
|
||||
$attributes = array_merge([
|
||||
'defaultContent' => '',
|
||||
'data' => $indexColumn,
|
||||
'name' => $indexColumn,
|
||||
'title' => '',
|
||||
'render' => null,
|
||||
'orderable' => false,
|
||||
'searchable' => false,
|
||||
'exportable' => false,
|
||||
'printable' => true,
|
||||
'footer' => '',
|
||||
], $attributes);
|
||||
|
||||
$this->collection->push(new Column($attributes));
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
324
vendor/yajra/laravel-datatables-html/src/Html/Editor/Editor.php
vendored
Normal file
324
vendor/yajra/laravel-datatables-html/src/Html/Editor/Editor.php
vendored
Normal file
|
|
@ -0,0 +1,324 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Fluent;
|
||||
use Yajra\DataTables\Html\Editor\Fields\Field;
|
||||
use Yajra\DataTables\Html\HasAuthorizations;
|
||||
use Yajra\DataTables\Utilities\Helper;
|
||||
|
||||
/**
|
||||
* @property string $instance
|
||||
* @property string|null $table
|
||||
* @property string|array|null $ajax
|
||||
* @property array $fields
|
||||
* @property string|null $template
|
||||
* @property string $idSrc
|
||||
* @property string $display
|
||||
* @property string $scripts
|
||||
* @property array $formOptions
|
||||
*/
|
||||
class Editor extends Fluent
|
||||
{
|
||||
use HasEvents;
|
||||
use HasAuthorizations;
|
||||
|
||||
const DISPLAY_LIGHTBOX = 'lightbox';
|
||||
const DISPLAY_ENVELOPE = 'envelope';
|
||||
const DISPLAY_BOOTSTRAP = 'bootstrap';
|
||||
const DISPLAY_FOUNDATION = 'foundation';
|
||||
const DISPLAY_JQUERYUI = 'jqueryui';
|
||||
|
||||
public array $events = [];
|
||||
|
||||
/**
|
||||
* Editor constructor.
|
||||
*
|
||||
* @param string|array $instance
|
||||
*/
|
||||
public function __construct($instance = 'editor')
|
||||
{
|
||||
$attributes['instance'] = $instance;
|
||||
|
||||
parent::__construct($attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make new Editor instance.
|
||||
*
|
||||
* @param array|string $instance
|
||||
* @return static
|
||||
*/
|
||||
public static function make(array|string $instance = 'editor'): static
|
||||
{
|
||||
if (is_array($instance)) {
|
||||
$instance = $instance['editor'] ?? 'editor';
|
||||
}
|
||||
|
||||
return new static($instance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Append raw scripts.
|
||||
*
|
||||
* @param string $scripts
|
||||
* @return $this
|
||||
*/
|
||||
public function scripts(string $scripts): static
|
||||
{
|
||||
$this->attributes['scripts'] = $scripts;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Editor's variable name / instance.
|
||||
*
|
||||
* @param string $instance
|
||||
* @return $this
|
||||
*/
|
||||
public function instance(string $instance): static
|
||||
{
|
||||
$this->attributes['instance'] = $instance;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Editor's ajax parameter.
|
||||
*
|
||||
* @param array|string $ajax
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/ajax
|
||||
*/
|
||||
public function ajax(array|string $ajax): static
|
||||
{
|
||||
$this->attributes['ajax'] = $ajax;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Editor's table source.
|
||||
*
|
||||
* @param string $table
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/table
|
||||
*/
|
||||
public function table(string $table): static
|
||||
{
|
||||
$this->attributes['table'] = $table;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Editor's idSrc option.
|
||||
*
|
||||
* @param string $idSrc
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/idSrc
|
||||
*/
|
||||
public function idSrc(string $idSrc = 'DT_RowId'): static
|
||||
{
|
||||
$this->attributes['idSrc'] = $idSrc;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Editor's display option.
|
||||
*
|
||||
* @param string $display
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/display
|
||||
*/
|
||||
public function display(string $display): static
|
||||
{
|
||||
$this->attributes['display'] = $display;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Editor's fields.
|
||||
*
|
||||
* @param array $fields
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/fields
|
||||
*/
|
||||
public function fields(array $fields): static
|
||||
{
|
||||
$this->attributes['fields'] = $fields;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Editor's bubble formOptions.
|
||||
*
|
||||
* @param array|FormOptions $formOptions
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/formOptions.bubble
|
||||
*/
|
||||
public function formOptionsBubble(array|FormOptions $formOptions): static
|
||||
{
|
||||
return $this->formOptions(['bubble' => Helper::castToArray($formOptions)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Editor's formOptions.
|
||||
*
|
||||
* @param array $formOptions
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/formOptions
|
||||
* @see https://editor.datatables.net/reference/type/form-options
|
||||
*/
|
||||
public function formOptions(array $formOptions): static
|
||||
{
|
||||
$this->attributes['formOptions'] = $formOptions;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Editor's inline formOptions.
|
||||
*
|
||||
* @param array|FormOptions $formOptions
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/formOptions.inline
|
||||
*/
|
||||
public function formOptionsInline(array|FormOptions $formOptions): static
|
||||
{
|
||||
return $this->formOptions(['inline' => Helper::castToArray($formOptions)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Editor's main formOptions.
|
||||
*
|
||||
* @param array|FormOptions $formOptions
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/formOptions.main
|
||||
*/
|
||||
public function formOptionsMain(array|FormOptions $formOptions): static
|
||||
{
|
||||
return $this->formOptions(['main' => Helper::castToArray($formOptions)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Editor's language.
|
||||
*
|
||||
* @param array $language
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/i18n
|
||||
*/
|
||||
public function language(array $language): static
|
||||
{
|
||||
$this->attributes['i18n'] = $language;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Editor's template.
|
||||
*
|
||||
* @param string $template
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/template
|
||||
*/
|
||||
public function template(string $template): static
|
||||
{
|
||||
$this->attributes['template'] = $template;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the fluent instance to an array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
if (! $this->isAuthorized()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$array = parent::toArray();
|
||||
|
||||
unset($array['events']);
|
||||
|
||||
foreach ((array) Arr::get($array, 'fields', []) as $key => &$field) {
|
||||
if ($field instanceof Field) {
|
||||
Arr::set($array['fields'], $key, $field->toArray());
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the fluent instance to JSON.
|
||||
*
|
||||
* @param int $options
|
||||
* @return string
|
||||
*/
|
||||
public function toJson($options = 0): string
|
||||
{
|
||||
$parameters = $this->jsonSerialize();
|
||||
|
||||
unset($parameters['events']);
|
||||
|
||||
return Helper::toJsonScript($parameters, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide fields on create action.
|
||||
*
|
||||
* @param array $fields
|
||||
* @return $this
|
||||
*/
|
||||
public function hiddenOnCreate(array $fields): static
|
||||
{
|
||||
return $this->hiddenOn('create', $fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide fields on specific action.
|
||||
*
|
||||
* @param string $action
|
||||
* @param array $fields
|
||||
* @return $this
|
||||
*/
|
||||
public function hiddenOn(string $action, array $fields): static
|
||||
{
|
||||
$script = 'function(e, mode, action) {';
|
||||
$script .= "if (action === '$action') {";
|
||||
foreach ($fields as $field) {
|
||||
$script .= "this.hide('$field');";
|
||||
}
|
||||
$script .= '} else {';
|
||||
foreach ($fields as $field) {
|
||||
$script .= "this.show('$field');";
|
||||
}
|
||||
$script .= '}';
|
||||
$script .= 'return true;';
|
||||
$script .= '}';
|
||||
|
||||
$this->onPreOpen($script);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide fields on edit action.
|
||||
*
|
||||
* @param array $fields
|
||||
* @return $this
|
||||
*/
|
||||
public function hiddenOnEdit(array $fields): static
|
||||
{
|
||||
return $this->hiddenOn('edit', $fields);
|
||||
}
|
||||
}
|
||||
31
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/BelongsTo.php
vendored
Normal file
31
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/BelongsTo.php
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class BelongsTo extends Select
|
||||
{
|
||||
/**
|
||||
* @param class-string<\Illuminate\Database\Eloquent\Model>|Builder $class
|
||||
* @param string $text
|
||||
* @param string $id
|
||||
* @param string|null $foreign
|
||||
* @return static
|
||||
*/
|
||||
public static function model(Builder|string $class, string $text, string $id = 'id', string $foreign = null): static
|
||||
{
|
||||
if ($class instanceof Builder) {
|
||||
$table = $class->getModel()->getTable();
|
||||
} else {
|
||||
$table = (new $class)->getTable();
|
||||
}
|
||||
|
||||
$table = Str::singular($table);
|
||||
$foreign = $foreign ?? $table.'_id';
|
||||
|
||||
return self::make($foreign, Str::title($table))
|
||||
->modelOptions($class, $text, $id);
|
||||
}
|
||||
}
|
||||
20
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Boolean.php
vendored
Normal file
20
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Boolean.php
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
class Boolean extends Checkbox
|
||||
{
|
||||
/**
|
||||
* Make a new instance of a field.
|
||||
*
|
||||
* @param array|string $name
|
||||
* @param string $label
|
||||
* @return static
|
||||
*/
|
||||
public static function make(array|string $name, string $label = ''): static
|
||||
{
|
||||
return parent::make($name, $label)->separator(',')->options(
|
||||
Options::make()->append('', 1)
|
||||
);
|
||||
}
|
||||
}
|
||||
8
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Checkbox.php
vendored
Normal file
8
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Checkbox.php
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
class Checkbox extends Field
|
||||
{
|
||||
protected string $type = 'checkbox';
|
||||
}
|
||||
18
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Date.php
vendored
Normal file
18
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Date.php
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
class Date extends DateTime
|
||||
{
|
||||
/**
|
||||
* Make a new instance of a field.
|
||||
*
|
||||
* @param array|string $name
|
||||
* @param string $label
|
||||
* @return static
|
||||
*/
|
||||
public static function make(array|string $name, string $label = ''): static
|
||||
{
|
||||
return parent::make($name, $label)->format('YYYY-MM-DD');
|
||||
}
|
||||
}
|
||||
166
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/DateTime.php
vendored
Normal file
166
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/DateTime.php
vendored
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
class DateTime extends Field
|
||||
{
|
||||
protected string $type = 'datetime';
|
||||
|
||||
/**
|
||||
* Make a new instance of a field.
|
||||
*
|
||||
* @param array|string $name
|
||||
* @param string $label
|
||||
* @return static
|
||||
*/
|
||||
public static function make(array|string $name, string $label = ''): static
|
||||
{
|
||||
return parent::make($name, $label)->format('YYYY-MM-DD hh:mm a');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set format to military time (24 hrs).
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function military(): static
|
||||
{
|
||||
return $this->format('YYYY-MM-DD HH:mm');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $dateTime
|
||||
* @param string $format
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/examples/dates/options-min-max.html
|
||||
*/
|
||||
public function minDate(\DateTime $dateTime, string $format = 'Y-m-d'): static
|
||||
{
|
||||
return $this->opts(['minDate' => "new Date('".$dateTime->format($format)."')"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $dateTime
|
||||
* @param string $format
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/examples/dates/options-min-max.html
|
||||
*/
|
||||
public function maxDate(\DateTime $dateTime, string $format = 'Y-m-d'): static
|
||||
{
|
||||
return $this->opts(['maxDate' => "new Date('".$dateTime->format($format)."')"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $state
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/examples/dates/options-week-numbers.html
|
||||
*/
|
||||
public function showWeekNumber(bool $state = true): static
|
||||
{
|
||||
return $this->opts(['showWeekNumber' => $state]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $days
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/examples/dates/options-disable-days.html
|
||||
*/
|
||||
public function disableDays(array $days): static
|
||||
{
|
||||
return $this->opts(['disableDays' => $days]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $minutes
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/examples/dates/time-increment.html
|
||||
*/
|
||||
public function minutesIncrement(int $minutes): static
|
||||
{
|
||||
return $this->opts(['minutesIncrement' => $minutes]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $seconds
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/examples/dates/time-increment.html
|
||||
*/
|
||||
public function secondsIncrement(int $seconds): static
|
||||
{
|
||||
return $this->opts(['secondsIncrement' => $seconds]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $hours
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/examples/dates/datetime.html
|
||||
*/
|
||||
public function hoursAvailable(array $hours): static
|
||||
{
|
||||
return $this->opts(['hoursAvailable' => $hours]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $minutes
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/examples/dates/datetime.html
|
||||
*/
|
||||
public function minutesAvailable(array $minutes): static
|
||||
{
|
||||
return $this->opts(['minutesAvailable' => $minutes]);
|
||||
}
|
||||
|
||||
/**
|
||||
* The format of the date string loaded from the server for the field's
|
||||
* value and also for sending to the server on form submission.
|
||||
* The formatting options are defined by Moment.js.
|
||||
*
|
||||
* @param string $format
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/field/datetime#Options
|
||||
* @see https://momentjs.com/docs/#/displaying/format/
|
||||
*/
|
||||
public function wireFormat(string $format = 'YYYY-MM-DDTHH:mm:ss.000000Z'): static
|
||||
{
|
||||
$this->attributes['wireFormat'] = $format;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow (default), or disallow, the end user to type into the date / time input element.
|
||||
* If disallowed, they must use the calendar picker to enter data. This can be useful
|
||||
* if you are using a more complex date format and wish to disallow the user from
|
||||
* potentially making typing mistakes, although note that it does also disallow
|
||||
* pasting of data.
|
||||
*
|
||||
* @param bool $state
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/field/datetime#Options
|
||||
*/
|
||||
public function keyInput(bool $state = true): static
|
||||
{
|
||||
$this->attributes['keyInput'] = $state;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The format of the date string that will be shown to the end user in the input element.
|
||||
* The formatting options are defined by Moment.js. If a format is used that is not
|
||||
* ISO8061 (i.e. YYYY-MM-DD) and Moment.js has not been included, Editor will
|
||||
* throw an error stating that Moment.js must be included for custom
|
||||
* formatting to be used.
|
||||
*
|
||||
* @param string $format
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/field/datetime#Options
|
||||
* @see https://momentjs.com/docs/#/displaying/format/
|
||||
*/
|
||||
public function displayFormat(string $format = 'YYYY-MM-DD hh:mm a'): static
|
||||
{
|
||||
$this->attributes['displayFormat'] = $format;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
398
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Field.php
vendored
Normal file
398
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Field.php
vendored
Normal file
|
|
@ -0,0 +1,398 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Query\Builder as QueryBuilder;
|
||||
use Illuminate\Support\Fluent;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use Yajra\DataTables\Html\HasAuthorizations;
|
||||
|
||||
/**
|
||||
* @see https://editor.datatables.net/reference/option/
|
||||
*/
|
||||
class Field extends Fluent
|
||||
{
|
||||
use HasAuthorizations;
|
||||
use Macroable;
|
||||
|
||||
/**
|
||||
* Field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $type = 'text';
|
||||
|
||||
/**
|
||||
* Password constructor.
|
||||
*
|
||||
* @param array $attributes
|
||||
*/
|
||||
public function __construct($attributes = [])
|
||||
{
|
||||
$attributes['type'] = $attributes['type'] ?? $this->type;
|
||||
|
||||
parent::__construct($attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a new instance of a field.
|
||||
*
|
||||
* @param array|string $name
|
||||
* @param string $label
|
||||
* @return static
|
||||
*/
|
||||
public static function make(array|string $name, string $label = ''): static
|
||||
{
|
||||
if (is_array($name)) {
|
||||
return new static($name);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'name' => $name,
|
||||
'label' => $label ?: Str::title(str_replace('_', ' ', $name)),
|
||||
];
|
||||
|
||||
return new static($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $label
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/fields.label
|
||||
*/
|
||||
public function label(string $label): static
|
||||
{
|
||||
$this->attributes['label'] = $label;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/fields.name
|
||||
*/
|
||||
public function name(string $name): static
|
||||
{
|
||||
$this->attributes['name'] = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $data
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/fields.data
|
||||
*/
|
||||
public function data(string $data): static
|
||||
{
|
||||
$this->attributes['data'] = $data;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/fields.type
|
||||
*/
|
||||
public function type(string $type): static
|
||||
{
|
||||
$this->attributes['type'] = $type;
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get options from a model.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder|class-string<\Illuminate\Database\Eloquent\Model> $model
|
||||
* @param string $value
|
||||
* @param string $key
|
||||
* @return $this
|
||||
*/
|
||||
public function modelOptions(Builder|string $model, string $value, string $key = 'id'): static
|
||||
{
|
||||
return $this->options(
|
||||
Options::model($model, $value, $key)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get options from a Enum::cases().
|
||||
*
|
||||
* @param array $cases
|
||||
* @return $this
|
||||
*/
|
||||
public function enumOptions(array $cases): static
|
||||
{
|
||||
$options = [];
|
||||
foreach ($cases as $case) {
|
||||
$options[] = [
|
||||
'value' => $case->value,
|
||||
'label' => $case->value,
|
||||
];
|
||||
}
|
||||
|
||||
return $this->options($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set select options.
|
||||
*
|
||||
* @param array|Arrayable $options
|
||||
* @return $this
|
||||
*/
|
||||
public function options(array|Arrayable $options): static
|
||||
{
|
||||
if ($options instanceof Arrayable) {
|
||||
$options = $options->toArray();
|
||||
}
|
||||
|
||||
$this->attributes['options'] = $options;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get options from a table.
|
||||
*
|
||||
* @param QueryBuilder|\Closure|string $table
|
||||
* @param string $value
|
||||
* @param string $key
|
||||
* @param \Closure|null $whereCallback
|
||||
* @param string|null $connection
|
||||
* @return $this
|
||||
*/
|
||||
public function tableOptions(
|
||||
QueryBuilder|Closure|string $table,
|
||||
string $value,
|
||||
string $key = 'id',
|
||||
Closure $whereCallback = null,
|
||||
string $connection = null
|
||||
): static {
|
||||
return $this->options(
|
||||
Options::table($table, $value, $key, $whereCallback, $connection)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set checkbox separator.
|
||||
*
|
||||
* @param string $separator
|
||||
* @return $this
|
||||
*/
|
||||
public function separator(string $separator = ','): static
|
||||
{
|
||||
$this->attributes['separator'] = $separator;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set dateTime format.
|
||||
*
|
||||
* @param string $format
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/field/datetime
|
||||
*/
|
||||
public function format(string $format): static
|
||||
{
|
||||
$this->attributes['format'] = $format;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field default value.
|
||||
*
|
||||
* @param float|bool|int|string|array $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/fields.def
|
||||
*/
|
||||
public function default(float|bool|int|string|array $value): static
|
||||
{
|
||||
$this->attributes['def'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field message value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/fields.message
|
||||
*/
|
||||
public function message(string $value): static
|
||||
{
|
||||
$this->attributes['message'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field fieldInfo value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/fields.fieldInfo
|
||||
*/
|
||||
public function fieldInfo(string $value): static
|
||||
{
|
||||
$this->attributes['fieldInfo'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field labelInfo value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/fields.labelInfo
|
||||
*/
|
||||
public function labelInfo(string $value): static
|
||||
{
|
||||
$this->attributes['labelInfo'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field entityDecode value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/fields.entityDecode
|
||||
*/
|
||||
public function entityDecode(bool $value): static
|
||||
{
|
||||
$this->attributes['entityDecode'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field multiEditable value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/fields.multiEditable
|
||||
*/
|
||||
public function multiEditable(bool $value): static
|
||||
{
|
||||
$this->attributes['multiEditable'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field id value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/fields.id
|
||||
*/
|
||||
public function id(string $value): static
|
||||
{
|
||||
$this->attributes['id'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field submit value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/fields.submit
|
||||
*/
|
||||
public function submit(bool $value): static
|
||||
{
|
||||
$this->attributes['submit'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field compare value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/fields.compare
|
||||
*/
|
||||
public function compare(bool $value): static
|
||||
{
|
||||
$this->attributes['compare'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field opts value.
|
||||
*
|
||||
* @param array $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/forums/discussion/comment/156581/#Comment_156581
|
||||
*/
|
||||
public function opts(array $value): static
|
||||
{
|
||||
if (! isset($this->attributes['opts'])) {
|
||||
$this->attributes['opts'] = $value;
|
||||
} else {
|
||||
$this->attributes['opts'] = array_merge((array) $this->attributes['opts'], $value);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field element html attributes.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param int|bool|string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/forums/discussion/comment/156581/#Comment_156581
|
||||
*/
|
||||
public function attr(string $attribute, int|bool|string $value): static
|
||||
{
|
||||
if (! isset($this->attributes['attr'])) {
|
||||
$this->attributes['attr'] = [];
|
||||
}
|
||||
|
||||
$attributes = (array) $this->attributes['attr'];
|
||||
$attributes[$attribute] = $value;
|
||||
|
||||
$this->attributes['attr'] = $attributes;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType(): string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace null values with the field's default on edit.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/option/fields.nullDefault
|
||||
*/
|
||||
public function nullDefault(bool $value = true): static
|
||||
{
|
||||
$this->attributes['nullDefault'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
205
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/File.php
vendored
Normal file
205
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/File.php
vendored
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
/**
|
||||
* @see https://editor.datatables.net/reference/field/upload
|
||||
* @see https://editor.datatables.net/examples/advanced/upload.html
|
||||
* @see https://editor.datatables.net/examples/advanced/upload-many.html
|
||||
*/
|
||||
class File extends Field
|
||||
{
|
||||
protected string $type = 'upload';
|
||||
|
||||
/**
|
||||
* Editor instance variable name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $editor = 'editor';
|
||||
|
||||
/**
|
||||
* @param array|string $name
|
||||
* @param string $label
|
||||
* @return static
|
||||
*/
|
||||
public static function make(array|string $name, string $label = ''): static
|
||||
{
|
||||
$field = parent::make($name, $label);
|
||||
|
||||
return $field->displayFile()->clearText()->noImageText();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function ajax(string $value): static
|
||||
{
|
||||
$this->attributes['ajax'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function ajaxData(string $value): static
|
||||
{
|
||||
$this->attributes['ajaxData'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
*/
|
||||
public function dragDrop(bool $value = true): static
|
||||
{
|
||||
$this->attributes['dragDrop'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function dragDropText(string $value): static
|
||||
{
|
||||
$this->attributes['dragDropText'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function fileReadText(string $value): static
|
||||
{
|
||||
$this->attributes['fileReadText'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function noFileText(string $value): static
|
||||
{
|
||||
$this->attributes['noFileText'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function processingText(string $value): static
|
||||
{
|
||||
$this->attributes['processingText'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function uploadText(string $value): static
|
||||
{
|
||||
$this->attributes['uploadText'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set editor instance for file upload.
|
||||
*
|
||||
* @param string $editor
|
||||
* @return $this
|
||||
*/
|
||||
public function editor(string $editor): static
|
||||
{
|
||||
$this->editor = $editor;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display image upon upload.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function displayImage(): static
|
||||
{
|
||||
// TODO: Use Laravel filesystem instead of hard coded storage path
|
||||
return $this->display(<<<SCRIPT
|
||||
function (file_id) {
|
||||
return file_id ? '<img src="storage/' + file_id + '" alt=""/>' : null;
|
||||
}
|
||||
SCRIPT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function display(string $value): static
|
||||
{
|
||||
$this->attributes['display'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the file path.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function displayFile(): static
|
||||
{
|
||||
return $this->display("function (file_id) { return file_id; }");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function clearText(string $value = 'Clear'): static
|
||||
{
|
||||
$this->attributes['clearText'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function noImageText(string $value = 'No image'): static
|
||||
{
|
||||
$this->attributes['noImageText'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $state
|
||||
* @return $this
|
||||
*/
|
||||
public function multiple(bool $state = true): static
|
||||
{
|
||||
if ($state) {
|
||||
$this->type('uploadMany');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
8
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Hidden.php
vendored
Normal file
8
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Hidden.php
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
class Hidden extends Field
|
||||
{
|
||||
protected string $type = 'hidden';
|
||||
}
|
||||
23
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Image.php
vendored
Normal file
23
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Image.php
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
/**
|
||||
* @see https://editor.datatables.net/reference/field/upload
|
||||
* @see https://editor.datatables.net/examples/advanced/upload.html
|
||||
* @see https://editor.datatables.net/examples/advanced/upload-many.html
|
||||
*/
|
||||
class Image extends File
|
||||
{
|
||||
protected string $type = 'upload';
|
||||
|
||||
/**
|
||||
* @param array|string $name
|
||||
* @param string $label
|
||||
* @return static
|
||||
*/
|
||||
public static function make(array|string $name, string $label = ''): static
|
||||
{
|
||||
return parent::make($name, $label)->displayImage();
|
||||
}
|
||||
}
|
||||
11
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Number.php
vendored
Normal file
11
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Number.php
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
class Number extends Field
|
||||
{
|
||||
public static function make(array|string $name, string $label = ''): static
|
||||
{
|
||||
return parent::make($name, $label)->attr('type', 'number');
|
||||
}
|
||||
}
|
||||
125
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Options.php
vendored
Normal file
125
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Options.php
vendored
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Database\Eloquent\Builder as EloquentBuilder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* @template TKey of array-key
|
||||
* @template TValue
|
||||
*/
|
||||
class Options extends Collection
|
||||
{
|
||||
/**
|
||||
* Return a Yes/No options.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public static function yesNo(): static
|
||||
{
|
||||
$data = [
|
||||
['label' => __('Yes'), 'value' => 1],
|
||||
['label' => __('No'), 'value' => 0],
|
||||
];
|
||||
|
||||
return new static($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get options from a model.
|
||||
*
|
||||
* @param class-string<Model>|\Illuminate\Database\Eloquent\Builder $model
|
||||
* @param string $value
|
||||
* @param string $key
|
||||
* @return Collection
|
||||
*/
|
||||
public static function model(string|EloquentBuilder $model, string $value, string $key = 'id'): Collection
|
||||
{
|
||||
if (! $model instanceof EloquentBuilder) {
|
||||
$model = $model::query();
|
||||
}
|
||||
|
||||
return $model->get()->map(function ($model) use ($value, $key) {
|
||||
return [
|
||||
'value' => $model->{$key},
|
||||
'label' => $model->{$value},
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get options from a table.
|
||||
*
|
||||
* @param \Closure|\Illuminate\Database\Query\Builder|string $table
|
||||
* @param string $value
|
||||
* @param string $key
|
||||
* @param \Closure|null $callback
|
||||
* @param string|null $connection
|
||||
* @return Collection
|
||||
*/
|
||||
public static function table(
|
||||
Closure|Builder|string $table,
|
||||
string $value,
|
||||
string $key = 'id',
|
||||
Closure $callback = null,
|
||||
string $connection = null
|
||||
): Collection {
|
||||
$query = DB::connection($connection)
|
||||
->table($table)
|
||||
->select("$value as label", "$key as value");
|
||||
|
||||
if (is_callable($callback)) {
|
||||
$callback($query);
|
||||
}
|
||||
|
||||
return $query->get()->map(function ($row) {
|
||||
return (array) $row;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a True/False options.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public static function trueFalse(): static
|
||||
{
|
||||
$data = [
|
||||
['label' => __('True'), 'value' => 1],
|
||||
['label' => __('False'), 'value' => 0],
|
||||
];
|
||||
|
||||
return new static($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Push an item onto the end of the collection.
|
||||
*
|
||||
* @param string $value
|
||||
* @param int|string $key
|
||||
* @return static
|
||||
*/
|
||||
public function append(string $value, int|string $key): static
|
||||
{
|
||||
return $this->push(['label' => $value, 'value' => $key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Push an item onto the beginning of the collection.
|
||||
*
|
||||
* @param TValue $value
|
||||
* @param TKey $key
|
||||
* @return static
|
||||
*/
|
||||
public function prepend($value, $key = null): static
|
||||
{
|
||||
$data = ['label' => $value, 'value' => $key];
|
||||
|
||||
return parent::prepend($data);
|
||||
}
|
||||
}
|
||||
8
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Password.php
vendored
Normal file
8
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Password.php
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
class Password extends Field
|
||||
{
|
||||
protected string $type = 'password';
|
||||
}
|
||||
8
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Radio.php
vendored
Normal file
8
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Radio.php
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
class Radio extends Field
|
||||
{
|
||||
protected string $type = 'radio';
|
||||
}
|
||||
8
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/ReadOnlyField.php
vendored
Normal file
8
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/ReadOnlyField.php
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
class ReadOnlyField extends Field
|
||||
{
|
||||
protected string $type = 'readonly';
|
||||
}
|
||||
84
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Select.php
vendored
Normal file
84
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Select.php
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
/**
|
||||
* @see https://editor.datatables.net/reference/field/select
|
||||
*/
|
||||
class Select extends Field
|
||||
{
|
||||
protected string $type = 'select';
|
||||
|
||||
/**
|
||||
* Set field multiple value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
*/
|
||||
public function multiple(bool $value = true): static
|
||||
{
|
||||
$this->attributes['multiple'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field optionsPair value.
|
||||
*
|
||||
* @param array|string $label
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function optionsPair(array|string $label = 'label', string $value = 'value'): static
|
||||
{
|
||||
if (is_array($label)) {
|
||||
$this->attributes['optionsPair'] = $label;
|
||||
} else {
|
||||
$this->attributes['optionsPair'] = [
|
||||
'label' => $label,
|
||||
'value' => $value,
|
||||
];
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field placeholder value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function placeholder(string $value): static
|
||||
{
|
||||
$this->attributes['placeholder'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field placeholderDisabled value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
*/
|
||||
public function placeholderDisabled(bool $value): static
|
||||
{
|
||||
$this->attributes['placeholderDisabled'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field placeholderValue value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function placeholderValue(string $value): static
|
||||
{
|
||||
$this->attributes['placeholderValue'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
135
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Select2.php
vendored
Normal file
135
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Select2.php
vendored
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
/**
|
||||
* @see https://editor.datatables.net/plug-ins/field-type/editor.select2
|
||||
*/
|
||||
class Select2 extends Select
|
||||
{
|
||||
protected string $type = 'select2';
|
||||
|
||||
/**
|
||||
* @param bool $state
|
||||
* @return $this
|
||||
*/
|
||||
public function allowClear(bool $state = true): static
|
||||
{
|
||||
return $this->opts(['allowClear' => $state]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function placeholder(string $value): static
|
||||
{
|
||||
return $this->optsPlaceholder($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text
|
||||
* @param string $id
|
||||
* @return $this
|
||||
*/
|
||||
public function optsPlaceholder(string $text = '', string $id = ''): static
|
||||
{
|
||||
return $this->opts([
|
||||
'placeholder' => [
|
||||
'id' => $id,
|
||||
'text' => $text,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set select2 ajax option.
|
||||
*
|
||||
* @param array|string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function ajax(array|string $value): static
|
||||
{
|
||||
$ajax = $this->opts['ajax'] ?? [];
|
||||
|
||||
if (is_array($value)) {
|
||||
return $this->opts(['ajax' => array_merge($ajax, $value)]);
|
||||
}
|
||||
|
||||
return $this->opts(['ajax' => array_merge($ajax, ['url' => $value])]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set select2 ajax url option.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function ajaxUrl(string $value): static
|
||||
{
|
||||
return $this->ajax(['url' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set select2 ajaxDelay option.
|
||||
*
|
||||
* @param int $value
|
||||
* @return $this
|
||||
*/
|
||||
public function ajaxDelay(int $value = 250): static
|
||||
{
|
||||
return $this->ajax(['delay' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set select2 ajax data option.
|
||||
*
|
||||
* @param array|string $data
|
||||
* @return $this
|
||||
*/
|
||||
public function ajaxData(array|string $data): static
|
||||
{
|
||||
if (is_array($data)) {
|
||||
$script = 'function(params) {';
|
||||
foreach ($data as $key => $value) {
|
||||
$value = json_encode($value);
|
||||
$script .= " params.$key = $value; ";
|
||||
}
|
||||
$script .= 'return params; }';
|
||||
|
||||
$data = $script;
|
||||
}
|
||||
|
||||
return $this->ajax(['data' => $data]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set select2 ajax processResults option to process a paginated results.
|
||||
*
|
||||
* @param string $display
|
||||
* @param string $id
|
||||
* @param string $wrap
|
||||
* @return $this
|
||||
*/
|
||||
public function processPaginatedResults(string $display = 'text', string $id = 'id', string $wrap = 'results'): static
|
||||
{
|
||||
$script = 'function(data, params) { ';
|
||||
$script .= 'params.page = params.page || 1; ';
|
||||
$script .= "data.$wrap.map(function(e) { e.text = e.$display; e.id = e.$id; return e; }); ";
|
||||
$script .= "return { results: data.$wrap, pagination: { more: data.meta.current_page < data.meta.last_page } };";
|
||||
$script .= '}';
|
||||
|
||||
return $this->processResults($script);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set select2 ajax processResults option.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function processResults(string $value): static
|
||||
{
|
||||
return $this->ajax(['processResults' => $value]);
|
||||
}
|
||||
}
|
||||
7
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Text.php
vendored
Normal file
7
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Text.php
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
class Text extends Field
|
||||
{
|
||||
}
|
||||
26
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/TextArea.php
vendored
Normal file
26
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/TextArea.php
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
class TextArea extends Field
|
||||
{
|
||||
protected string $type = 'textarea';
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
* @return static
|
||||
*/
|
||||
public function rows(int $value): static
|
||||
{
|
||||
return $this->attr('rows', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
* @return static
|
||||
*/
|
||||
public function cols(int $value): static
|
||||
{
|
||||
return $this->attr('cols', $value);
|
||||
}
|
||||
}
|
||||
30
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Time.php
vendored
Normal file
30
vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Time.php
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor\Fields;
|
||||
|
||||
class Time extends DateTime
|
||||
{
|
||||
/**
|
||||
* Make a new instance of a field.
|
||||
*
|
||||
* @param array|string $name
|
||||
* @param string $label
|
||||
* @return static
|
||||
*/
|
||||
public static function make(array|string $name, string $label = ''): static
|
||||
{
|
||||
$field = parent::make($name, $label);
|
||||
|
||||
return $field->format('hh:mm a');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set format to military time (24 hrs).
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function military(): static
|
||||
{
|
||||
return $this->format('HH:mm');
|
||||
}
|
||||
}
|
||||
211
vendor/yajra/laravel-datatables-html/src/Html/Editor/FormOptions.php
vendored
Normal file
211
vendor/yajra/laravel-datatables-html/src/Html/Editor/FormOptions.php
vendored
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor;
|
||||
|
||||
use Illuminate\Support\Fluent;
|
||||
|
||||
/**
|
||||
* @see https://editor.datatables.net/reference/type/form-options
|
||||
*/
|
||||
class FormOptions extends Fluent
|
||||
{
|
||||
/**
|
||||
* @param array $attributes
|
||||
* @return static
|
||||
*/
|
||||
public static function make(array $attributes = []): static
|
||||
{
|
||||
return new static($attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|string|null $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/type/form-options#focus
|
||||
*/
|
||||
public function focus(int|string $value = null): static
|
||||
{
|
||||
$this->attributes['focus'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/type/form-options#nest
|
||||
*/
|
||||
public function nest(bool $value): static
|
||||
{
|
||||
$this->attributes['nest'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/type/form-options#onBackground
|
||||
*/
|
||||
public function onBackground(string $value = 'blur'): static
|
||||
{
|
||||
$this->attributes['onBackground'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/type/form-options#onBlur
|
||||
*/
|
||||
public function onBlur(string $value = 'close'): static
|
||||
{
|
||||
$this->attributes['onBlur'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/type/form-options#onComplete
|
||||
*/
|
||||
public function onComplete(string $value = 'close'): static
|
||||
{
|
||||
$this->attributes['onComplete'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/type/form-options#onEsc
|
||||
*/
|
||||
public function onEsc(string $value = 'close'): static
|
||||
{
|
||||
$this->attributes['onEsc'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/type/form-options#onFieldError
|
||||
*/
|
||||
public function onFieldError(string $value = 'focus'): static
|
||||
{
|
||||
$this->attributes['onFieldError'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/type/form-options#onReturn
|
||||
*/
|
||||
public function onReturn(string $value = 'submit'): static
|
||||
{
|
||||
$this->attributes['onReturn'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/type/form-options#submit
|
||||
*/
|
||||
public function submit(string $value = 'changed'): static
|
||||
{
|
||||
$this->attributes['submit'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/type/form-options#scope
|
||||
*/
|
||||
public function scope(string $value = 'row'): static
|
||||
{
|
||||
$this->attributes['scope'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/type/form-options#buttons
|
||||
*/
|
||||
public function buttons(array|string $value): static
|
||||
{
|
||||
$this->attributes['buttons'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/type/form-options#drawType
|
||||
*/
|
||||
public function drawType(string $value = ''): static
|
||||
{
|
||||
$this->attributes['drawType'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool|string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/type/form-options#message
|
||||
*/
|
||||
public function message(bool|string $value = ''): static
|
||||
{
|
||||
$this->attributes['message'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/type/form-options#submitTrigger
|
||||
*/
|
||||
public function submitTrigger(int|string $value): static
|
||||
{
|
||||
$this->attributes['submitTrigger'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/type/form-options#submitHtml
|
||||
*/
|
||||
public function submitHtml(string $value): static
|
||||
{
|
||||
$this->attributes['submitHtml'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool|string $value
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/type/form-options#title
|
||||
*/
|
||||
public function title(bool|string $value): static
|
||||
{
|
||||
$this->attributes['title'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
84
vendor/yajra/laravel-datatables-html/src/Html/Editor/HasEvents.php
vendored
Normal file
84
vendor/yajra/laravel-datatables-html/src/Html/Editor/HasEvents.php
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Editor;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @method $this onClose($script)
|
||||
* @method $this onClosed($script)
|
||||
* @method $this onCreate($script)
|
||||
* @method $this onDisplayOrder($script)
|
||||
* @method $this onEdit($script)
|
||||
* @method $this onInitCreate($script)
|
||||
* @method $this onInitEdit($script)
|
||||
* @method $this onInitEditor($script)
|
||||
* @method $this onInitRemove($script)
|
||||
* @method $this onInitSubmit($script)
|
||||
* @method $this onOpen($script)
|
||||
* @method $this onOpened($script)
|
||||
* @method $this onPostCreate($script)
|
||||
* @method $this onPostEdit($script)
|
||||
* @method $this onPostRemove($script)
|
||||
* @method $this onPostSubmit($script)
|
||||
* @method $this onPostUpload($script)
|
||||
* @method $this onPreBlur($script)
|
||||
* @method $this onPreBlurCancelled($script)
|
||||
* @method $this onPreClose($script)
|
||||
* @method $this onPreCreate($script)
|
||||
* @method $this onPreEdit($script)
|
||||
* @method $this onPreOpen($script)
|
||||
* @method $this onPreOpenCancelled($script)
|
||||
* @method $this onPreRemove($script)
|
||||
* @method $this onPreSubmit($script)
|
||||
* @method $this onPreSubmitCancelled($script)
|
||||
* @method $this onPreUpload($script)
|
||||
* @method $this onPreUploadCancelled($script)
|
||||
* @method $this onProcessing($script)
|
||||
* @method $this onRemove($script)
|
||||
* @method $this onSetData($script)
|
||||
* @method $this onSubmitComplete($script)
|
||||
* @method $this onSubmitError($script)
|
||||
* @method $this onSubmitSuccess($script)
|
||||
* @method $this onSubmitUnsuccessful($script)
|
||||
* @method $this onUploadXhrError($script)
|
||||
* @method $this onUploadXhrSuccess($script)
|
||||
*/
|
||||
trait HasEvents
|
||||
{
|
||||
/**
|
||||
* Magic method handler for editor events.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array{0: string} $parameters
|
||||
* @return $this
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
if (Str::startsWith($method, 'on')) {
|
||||
$event = Str::camel(substr($method, 2, strlen($method) - 2));
|
||||
|
||||
return $this->on($event, $parameters[0]);
|
||||
}
|
||||
|
||||
return parent::__call($method, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Editor event listener scripts.
|
||||
*
|
||||
* @param string $event
|
||||
* @param mixed $script
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/reference/event
|
||||
*/
|
||||
public function on(string $event, mixed $script): static
|
||||
{
|
||||
$this->events[] = [
|
||||
'event' => $event,
|
||||
'script' => value($script),
|
||||
];
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
117
vendor/yajra/laravel-datatables-html/src/Html/HasAuthorizations.php
vendored
Normal file
117
vendor/yajra/laravel-datatables-html/src/Html/HasAuthorizations.php
vendored
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html;
|
||||
|
||||
use Illuminate\Contracts\Auth\Access\Authorizable;
|
||||
|
||||
trait HasAuthorizations
|
||||
{
|
||||
/**
|
||||
* Flag to check if user is authorized to use the button.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected bool $authorized = true;
|
||||
|
||||
/**
|
||||
* Make a button if condition is true.
|
||||
*
|
||||
* @param callable|bool $condition
|
||||
* @param array|string $options
|
||||
* @return static
|
||||
*/
|
||||
public static function makeIf(callable|bool $condition, array|string $options = []): static
|
||||
{
|
||||
if (is_callable($condition)) {
|
||||
$condition = value($condition);
|
||||
}
|
||||
|
||||
if ($condition === true) {
|
||||
return static::make($options);
|
||||
}
|
||||
|
||||
return app(static::class)->authorized(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set authorization status of the button.
|
||||
*
|
||||
* @param callable|bool $bool
|
||||
* @return static
|
||||
*/
|
||||
public function authorized(callable|bool $bool): static
|
||||
{
|
||||
$this->authorized = (bool) value($bool);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a button if the user is authorized.
|
||||
*
|
||||
* @param string $permission
|
||||
* @param array|string $options
|
||||
* @param Authorizable|null $user
|
||||
* @return static
|
||||
*/
|
||||
public static function makeIfCan(string $permission, array|string $options = [], Authorizable $user = null): static
|
||||
{
|
||||
if (is_null($user)) {
|
||||
$user = auth()->user();
|
||||
}
|
||||
|
||||
if ($user instanceof Authorizable && $user->can($permission)) {
|
||||
return static::make($options);
|
||||
}
|
||||
|
||||
return static::make([])->authorized(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a button if the user is not authorized.
|
||||
*
|
||||
* @param string $permission
|
||||
* @param array|string $options
|
||||
* @param Authorizable|null $user
|
||||
* @return static
|
||||
*/
|
||||
public static function makeIfCannot(
|
||||
string $permission,
|
||||
array|string $options = [],
|
||||
Authorizable $user = null
|
||||
): static {
|
||||
if (is_null($user)) {
|
||||
$user = auth()->user();
|
||||
}
|
||||
|
||||
if ($user instanceof Authorizable && ! $user->can($permission)) {
|
||||
return static::make($options);
|
||||
}
|
||||
|
||||
return app(static::class)->authorized(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the Fluent instance to an array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
if (! $this->isAuthorized()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return parent::toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if instance is authorized
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isAuthorized(): bool
|
||||
{
|
||||
return $this->authorized;
|
||||
}
|
||||
}
|
||||
76
vendor/yajra/laravel-datatables-html/src/Html/HasEditor.php
vendored
Normal file
76
vendor/yajra/laravel-datatables-html/src/Html/HasEditor.php
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html;
|
||||
|
||||
use Yajra\DataTables\Html\Editor\Editor;
|
||||
|
||||
trait HasEditor
|
||||
{
|
||||
/**
|
||||
* Collection of Editors.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected array $editors = [];
|
||||
|
||||
/**
|
||||
* Attach multiple editors to builder.
|
||||
*
|
||||
* @param array|mixed ...$editors
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/
|
||||
*/
|
||||
public function editors(...$editors): static
|
||||
{
|
||||
if (is_array($editors[0])) {
|
||||
$editors = $editors[0];
|
||||
}
|
||||
|
||||
$this->editors = [];
|
||||
|
||||
foreach ($editors as $editor) {
|
||||
if ($editor instanceof Editor) {
|
||||
$this->editor($editor);
|
||||
} else {
|
||||
$this->editor(new Editor($editor));
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Integrate with DataTables Editor.
|
||||
*
|
||||
* @param Editor $editor
|
||||
* @return $this
|
||||
* @see https://editor.datatables.net/
|
||||
*/
|
||||
public function editor(Editor $editor): static
|
||||
{
|
||||
/** @var string $template */
|
||||
$template = $this->config->get('datatables-html.editor', 'datatables::editor');
|
||||
|
||||
$this->setTemplate($template);
|
||||
|
||||
if (! $editor->table) {
|
||||
$editor->table('#'.$this->getTableAttribute('id'));
|
||||
}
|
||||
|
||||
if (! $editor->ajax) {
|
||||
$editor->ajax($this->getAjaxUrl());
|
||||
}
|
||||
|
||||
$this->editors[] = $editor;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getEditors(): array
|
||||
{
|
||||
return $this->editors;
|
||||
}
|
||||
}
|
||||
401
vendor/yajra/laravel-datatables-html/src/Html/HasOptions.php
vendored
Normal file
401
vendor/yajra/laravel-datatables-html/src/Html/HasOptions.php
vendored
Normal file
|
|
@ -0,0 +1,401 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html;
|
||||
|
||||
use Yajra\DataTables\Html\Options;
|
||||
|
||||
/**
|
||||
* DataTables - Options builder.
|
||||
*
|
||||
* @see https://datatables.net/reference/option/
|
||||
*/
|
||||
trait HasOptions
|
||||
{
|
||||
use Options\HasFeatures;
|
||||
use Options\HasAjax;
|
||||
use Options\HasCallbacks;
|
||||
use Options\HasColumns;
|
||||
use Options\HasInternationalisation;
|
||||
use Options\Plugins\AutoFill;
|
||||
use Options\Plugins\Buttons;
|
||||
use Options\Plugins\ColReorder;
|
||||
use Options\Plugins\FixedColumns;
|
||||
use Options\Plugins\FixedHeader;
|
||||
use Options\Plugins\KeyTable;
|
||||
use Options\Plugins\Responsive;
|
||||
use Options\Plugins\RowGroup;
|
||||
use Options\Plugins\RowReorder;
|
||||
use Options\Plugins\Scroller;
|
||||
use Options\Plugins\Select;
|
||||
use Options\Plugins\SearchPanes;
|
||||
|
||||
/**
|
||||
* Set deferLoading option value.
|
||||
*
|
||||
* @param array|int|null $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/deferLoading
|
||||
*/
|
||||
public function deferLoading(array|int $value = null): static
|
||||
{
|
||||
$this->attributes['deferLoading'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set destroy option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/destroy
|
||||
*/
|
||||
public function destroy(bool $value = false): static
|
||||
{
|
||||
$this->attributes['destroy'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set displayStart option value.
|
||||
*
|
||||
* @param int $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/displayStart
|
||||
*/
|
||||
public function displayStart(int $value = 0): static
|
||||
{
|
||||
$this->attributes['displayStart'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set dom option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/dom
|
||||
*/
|
||||
public function dom(string $value): static
|
||||
{
|
||||
$this->attributes['dom'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set lengthMenu option value.
|
||||
*
|
||||
* @param array $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/lengthMenu
|
||||
*/
|
||||
public function lengthMenu(array $value = [10, 25, 50, 100]): static
|
||||
{
|
||||
$this->attributes['lengthMenu'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set orders option value.
|
||||
*
|
||||
* @param array $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/order
|
||||
*/
|
||||
public function orders(array $value): static
|
||||
{
|
||||
$this->attributes['order'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set orderCellsTop option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/orderCellsTop
|
||||
*/
|
||||
public function orderCellsTop(bool $value = false): static
|
||||
{
|
||||
$this->attributes['orderCellsTop'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set orderClasses option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/orderClasses
|
||||
*/
|
||||
public function orderClasses(bool $value = true): static
|
||||
{
|
||||
$this->attributes['orderClasses'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Order option builder.
|
||||
*
|
||||
* @param array|int $index
|
||||
* @param string $direction
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/order
|
||||
*/
|
||||
public function orderBy(array|int $index, string $direction = 'desc'): static
|
||||
{
|
||||
if ($direction != 'desc') {
|
||||
$direction = 'asc';
|
||||
}
|
||||
|
||||
if (is_array($index)) {
|
||||
$this->attributes['order'][] = $index;
|
||||
} else {
|
||||
$this->attributes['order'][] = [$index, $direction];
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Order Fixed option builder.
|
||||
*
|
||||
* @param array|int $index
|
||||
* @param string $direction
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/orderFixed
|
||||
*/
|
||||
public function orderByFixed(array|int $index, string $direction = 'desc'): static
|
||||
{
|
||||
if ($direction != 'desc') {
|
||||
$direction = 'asc';
|
||||
}
|
||||
|
||||
if (is_array($index)) {
|
||||
$this->attributes['orderFixed'][] = $index;
|
||||
} else {
|
||||
$this->attributes['orderFixed'][] = [$index, $direction];
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set orderMulti option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/orderMulti
|
||||
*/
|
||||
public function orderMulti(bool $value = true): static
|
||||
{
|
||||
$this->attributes['orderMulti'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set pageLength option value.
|
||||
*
|
||||
* @param int $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/pageLength
|
||||
*/
|
||||
public function pageLength(int $value = 10): static
|
||||
{
|
||||
$this->attributes['pageLength'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set pagingType option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/pagingType
|
||||
*/
|
||||
public function pagingType(string $value = 'simple_numbers'): static
|
||||
{
|
||||
$this->attributes['pagingType'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set renderer option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/renderer
|
||||
*/
|
||||
public function renderer(string $value = 'bootstrap'): static
|
||||
{
|
||||
$this->attributes['renderer'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set retrieve option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/retrieve
|
||||
*/
|
||||
public function retrieve(bool $value = false): static
|
||||
{
|
||||
$this->attributes['retrieve'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set rowId option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/rowId
|
||||
*/
|
||||
public function rowId(string $value = 'DT_RowId'): static
|
||||
{
|
||||
$this->attributes['rowId'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set scrollCollapse option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/scrollCollapse
|
||||
*/
|
||||
public function scrollCollapse(bool $value = false): static
|
||||
{
|
||||
$this->attributes['scrollCollapse'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set search option value.
|
||||
*
|
||||
* @param array $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/search
|
||||
*/
|
||||
public function search(array $value): static
|
||||
{
|
||||
$this->attributes['search'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set searchCols option value.
|
||||
*
|
||||
* @param array $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/searchCols
|
||||
*/
|
||||
public function searchCols(array $value): static
|
||||
{
|
||||
$this->attributes['searchCols'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set searchDelay option value.
|
||||
*
|
||||
* @param int $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/searchDelay
|
||||
*/
|
||||
public function searchDelay(int $value): static
|
||||
{
|
||||
$this->attributes['searchDelay'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set stateDuration option value.
|
||||
*
|
||||
* @param int $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/stateDuration
|
||||
*/
|
||||
public function stateDuration(int $value): static
|
||||
{
|
||||
$this->attributes['stateDuration'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set stripeClasses option value.
|
||||
*
|
||||
* @param array $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/stripeClasses
|
||||
*/
|
||||
public function stripeClasses(array $value): static
|
||||
{
|
||||
$this->attributes['stripeClasses'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set tabIndex option value.
|
||||
*
|
||||
* @param int $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/tabIndex
|
||||
*/
|
||||
public function tabIndex(int $value = 0): static
|
||||
{
|
||||
$this->attributes['tabIndex'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param array|bool $value
|
||||
* @return $this
|
||||
*/
|
||||
public function setPluginAttribute(string $key, array|bool $value): static
|
||||
{
|
||||
if (is_array($value)) {
|
||||
$this->attributes[$key] = array_merge((array) ($this->attributes[$key] ?? []), $value);
|
||||
} else {
|
||||
$this->attributes[$key] = $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $plugin
|
||||
* @param string|null $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPluginAttribute(string $plugin, string $key = null): mixed
|
||||
{
|
||||
if (is_null($key)) {
|
||||
return $this->attributes[$plugin] ?? true;
|
||||
}
|
||||
|
||||
return $this->attributes[$plugin][$key] ?? false;
|
||||
}
|
||||
}
|
||||
205
vendor/yajra/laravel-datatables-html/src/Html/HasTable.php
vendored
Normal file
205
vendor/yajra/laravel-datatables-html/src/Html/HasTable.php
vendored
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
trait HasTable
|
||||
{
|
||||
protected ?string $theadClass = null;
|
||||
|
||||
/**
|
||||
* Get table computed table attributes.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getTableAttributes(): array
|
||||
{
|
||||
return $this->tableAttributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets HTML table "id" attribute.
|
||||
*
|
||||
* @param string $id
|
||||
* @return $this
|
||||
*/
|
||||
public function setTableId(string $id): static
|
||||
{
|
||||
return $this->setTableAttribute('id', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets HTML table attribute(s).
|
||||
*
|
||||
* @param array|string $attribute
|
||||
* @param string|null $value
|
||||
* @return $this
|
||||
*/
|
||||
public function setTableAttribute(array|string $attribute, string $value = null): static
|
||||
{
|
||||
if (is_array($attribute)) {
|
||||
return $this->setTableAttributes($attribute);
|
||||
}
|
||||
|
||||
$this->tableAttributes[$attribute] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets multiple HTML table attributes at once.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @return $this
|
||||
*/
|
||||
public function setTableAttributes(array $attributes): static
|
||||
{
|
||||
foreach ($attributes as $attribute => $value) {
|
||||
$this->tableAttributes[$attribute] = $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HTML table "id" attribute.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTableId(): string
|
||||
{
|
||||
return $this->getTableAttribute('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves HTML table attribute value.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @return string
|
||||
*/
|
||||
public function getTableAttribute(string $attribute): string
|
||||
{
|
||||
return $this->tableAttributes[$attribute] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add class names to the "class" attribute of HTML table.
|
||||
*
|
||||
* @param array|string $class
|
||||
* @return $this
|
||||
*/
|
||||
public function addTableClass(array|string $class): static
|
||||
{
|
||||
$class = is_array($class) ? implode(' ', $class) : $class;
|
||||
$currentClass = Arr::get(array_change_key_case($this->tableAttributes), 'class');
|
||||
|
||||
$classes = preg_split('#\s+#', $currentClass.' '.$class, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$class = implode(' ', array_unique((array) $classes));
|
||||
|
||||
return $this->setTableAttribute('class', $class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set table > thead class names.
|
||||
*
|
||||
* @param string $class
|
||||
* @return $this
|
||||
*/
|
||||
public function setTableHeadClass(string $class): static
|
||||
{
|
||||
$this->theadClass = " class=\"$class\"";
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove class names from the "class" attribute of HTML table.
|
||||
*
|
||||
* @param array|string $class
|
||||
* @return $this
|
||||
*/
|
||||
public function removeTableClass(array|string $class): static
|
||||
{
|
||||
$class = is_array($class) ? implode(' ', $class) : $class;
|
||||
$currentClass = $this->getTableAttribute('class');
|
||||
|
||||
$classes = array_diff(
|
||||
(array) preg_split('#\s+#', $currentClass, -1, PREG_SPLIT_NO_EMPTY),
|
||||
(array) preg_split('#\s+#', $class, -1, PREG_SPLIT_NO_EMPTY)
|
||||
);
|
||||
$class = implode(' ', array_unique($classes));
|
||||
|
||||
return $this->setTableAttribute('class', $class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile table headers and to support responsive extension.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function compileTableHeaders(): array
|
||||
{
|
||||
$th = [];
|
||||
|
||||
$this->collection->each(function (Column $column) use (&$th) {
|
||||
$only = Arr::only(
|
||||
$column->toArray(),
|
||||
['class', 'id', 'title', 'width', 'style', 'data-class', 'data-hide']
|
||||
);
|
||||
|
||||
$attributes = array_merge(
|
||||
$only,
|
||||
$column->attributes,
|
||||
isset($column['titleAttr']) ? ['title' => $column['titleAttr']] : []
|
||||
);
|
||||
|
||||
$thAttr = $this->html->attributes($attributes);
|
||||
$th[] = '<th'.$thAttr.'>'.$column['title'].'</th>';
|
||||
});
|
||||
|
||||
return $th;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile table search headers.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function compileTableSearchHeaders(): array
|
||||
{
|
||||
$search = [];
|
||||
|
||||
$this->collection->each(function (Column $column) use (&$search) {
|
||||
$search[] = $column['searchable'] ? '<th>'.($column['search'] ?? '').'</th>' : '<th></th>';
|
||||
});
|
||||
|
||||
return $search;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile table footer contents.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function compileTableFooter(): array
|
||||
{
|
||||
$footer = [];
|
||||
|
||||
$this->collection->each(function (Column $column) use (&$footer) {
|
||||
if (is_array($column->footer)) {
|
||||
$footerAttr = $this->html->attributes(
|
||||
Arr::only($column->footer, ['class', 'id', 'title', 'width', 'style', 'data-class', 'data-hide'])
|
||||
);
|
||||
|
||||
$title = $column->footer['title'] ?? '';
|
||||
|
||||
$footer[] = '<th '.$footerAttr.'>'.$title.'</th>';
|
||||
} else {
|
||||
$footer[] = '<th>'.$column->footer.'</th>';
|
||||
}
|
||||
});
|
||||
|
||||
return $footer;
|
||||
}
|
||||
}
|
||||
578
vendor/yajra/laravel-datatables-html/src/Html/HtmlBuilder.php
vendored
Normal file
578
vendor/yajra/laravel-datatables-html/src/Html/HtmlBuilder.php
vendored
Normal file
|
|
@ -0,0 +1,578 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html;
|
||||
|
||||
use Illuminate\Contracts\Routing\UrlGenerator;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class HtmlBuilder
|
||||
{
|
||||
/**
|
||||
* The URL generator instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Routing\UrlGenerator
|
||||
*/
|
||||
protected UrlGenerator $url;
|
||||
|
||||
/**
|
||||
* The View Factory instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
protected Factory $view;
|
||||
|
||||
/**
|
||||
* Create a new HTML builder instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Routing\UrlGenerator $url
|
||||
* @param \Illuminate\Contracts\View\Factory $view
|
||||
*/
|
||||
public function __construct(UrlGenerator $url, Factory $view)
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->view = $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert entities to HTML characters.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public function decode(string $value): string
|
||||
{
|
||||
return html_entity_decode($value, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a link to a JavaScript file.
|
||||
*
|
||||
* @param string $url
|
||||
* @param array $attributes
|
||||
* @param bool|null $secure
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function script(string $url, array $attributes = [], bool $secure = null): HtmlString
|
||||
{
|
||||
$attributes['src'] = $this->url->asset($url, $secure);
|
||||
|
||||
return $this->toHtmlString('<script'.$this->attributes($attributes).'></script>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform the string to an Html serializable object
|
||||
*
|
||||
* @param string $html
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
protected function toHtmlString(string $html): HtmlString
|
||||
{
|
||||
return new HtmlString($html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an HTML attribute string from an array.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @return string
|
||||
*/
|
||||
public function attributes(array $attributes): string
|
||||
{
|
||||
$html = [];
|
||||
|
||||
foreach ($attributes as $key => $value) {
|
||||
$element = $this->attributeElement($key, $value);
|
||||
|
||||
if (! is_null($element)) {
|
||||
$html[] = $element;
|
||||
}
|
||||
}
|
||||
|
||||
return ! empty($html) ? ' '.implode(' ', $html) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a single attribute element.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
protected function attributeElement(string $key, mixed $value): mixed
|
||||
{
|
||||
// For numeric keys we will assume that the value is a boolean attribute
|
||||
// where the presence of the attribute represents a true value and the
|
||||
// absence represents a false value.
|
||||
// This will convert HTML attributes such as "required" to a correct
|
||||
// form instead of using incorrect numerics.
|
||||
if (is_numeric($key)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
// Treat boolean attributes as HTML properties
|
||||
if (is_bool($value) && $key !== 'value') {
|
||||
return $value ? $key : '';
|
||||
}
|
||||
|
||||
if (is_array($value) && $key === 'class') {
|
||||
return 'class="'.implode(' ', $value).'"';
|
||||
}
|
||||
|
||||
if (is_bool($value) || is_float($value) || is_int($value) || is_resource($value) || is_string($value)) {
|
||||
return $key.'="'.e(strval($value), false).'"';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a link to a CSS file.
|
||||
*
|
||||
* @param string $url
|
||||
* @param array $attributes
|
||||
* @param bool|null $secure
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function style(string $url, array $attributes = [], bool $secure = null): HtmlString
|
||||
{
|
||||
$defaults = ['media' => 'all', 'type' => 'text/css', 'rel' => 'stylesheet'];
|
||||
|
||||
$attributes = array_merge($defaults, $attributes);
|
||||
|
||||
$attributes['href'] = $this->url->asset($url, $secure);
|
||||
|
||||
return $this->toHtmlString('<link'.$this->attributes($attributes).'>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an HTML image element.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string|null $alt
|
||||
* @param array $attributes
|
||||
* @param bool|null $secure
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function image(string $url, string $alt = null, array $attributes = [], bool $secure = null): HtmlString
|
||||
{
|
||||
$attributes['alt'] = $alt;
|
||||
|
||||
return $this->toHtmlString('<img src="'.$this->url->asset($url,
|
||||
$secure).'"'.$this->attributes($attributes).'>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a link to a Favicon file.
|
||||
*
|
||||
* @param string $url
|
||||
* @param array $attributes
|
||||
* @param bool|null $secure
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function favicon(string $url, array $attributes = [], bool $secure = null): HtmlString
|
||||
{
|
||||
$defaults = ['rel' => 'shortcut icon', 'type' => 'image/x-icon'];
|
||||
|
||||
$attributes = array_merge($defaults, $attributes);
|
||||
|
||||
$attributes['href'] = $this->url->asset($url, $secure);
|
||||
|
||||
return $this->toHtmlString('<link'.$this->attributes($attributes).'>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a HTTPS HTML link.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string|null $title
|
||||
* @param array $attributes
|
||||
* @param bool $escape
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function secureLink(
|
||||
string $url,
|
||||
string $title = null,
|
||||
array $attributes = [],
|
||||
bool $escape = true
|
||||
): HtmlString {
|
||||
return $this->link($url, $title, $attributes, true, $escape);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a HTML link.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string|null $title
|
||||
* @param array $attributes
|
||||
* @param bool|null $secure
|
||||
* @param bool $escape
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function link(
|
||||
string $url,
|
||||
string $title = null,
|
||||
array $attributes = [],
|
||||
bool $secure = null,
|
||||
bool $escape = true
|
||||
): HtmlString {
|
||||
$url = $this->url->to($url, [], $secure);
|
||||
|
||||
if (is_null($title)) {
|
||||
$title = $url;
|
||||
}
|
||||
|
||||
if ($escape) {
|
||||
$title = $this->entities($title);
|
||||
}
|
||||
|
||||
return $this->toHtmlString(
|
||||
'<a href="'.$this->entities($url).'"'.$this->attributes($attributes).'>'.$title.'</a>'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an HTML string to entities.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public function entities(string $value): string
|
||||
{
|
||||
return htmlentities($value, ENT_QUOTES, 'UTF-8', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a HTTPS HTML link to an asset.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string|null $title
|
||||
* @param array $attributes
|
||||
* @param bool $escape
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function linkSecureAsset(
|
||||
string $url,
|
||||
string $title = null,
|
||||
array $attributes = [],
|
||||
bool $escape = true
|
||||
): HtmlString {
|
||||
return $this->linkAsset($url, $title, $attributes, true, $escape);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a HTML link to an asset.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string|null $title
|
||||
* @param array $attributes
|
||||
* @param bool|null $secure
|
||||
* @param bool $escape
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function linkAsset(
|
||||
string $url,
|
||||
string $title = null,
|
||||
array $attributes = [],
|
||||
bool $secure = null,
|
||||
bool $escape = true
|
||||
): HtmlString {
|
||||
$url = $this->url->asset($url, $secure);
|
||||
|
||||
return $this->link($url, $title ?: $url, $attributes, $secure, $escape);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a HTML link to a named route.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string|null $title
|
||||
* @param array $parameters
|
||||
* @param array $attributes
|
||||
* @param bool|null $secure
|
||||
* @param bool $escape
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function linkRoute(
|
||||
string $name,
|
||||
string $title = null,
|
||||
array $parameters = [],
|
||||
array $attributes = [],
|
||||
bool $secure = null,
|
||||
bool $escape = true
|
||||
): HtmlString {
|
||||
return $this->link($this->url->route($name, $parameters), $title, $attributes, $secure, $escape);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a HTML link to a controller action.
|
||||
*
|
||||
* @param string $action
|
||||
* @param string|null $title
|
||||
* @param array $parameters
|
||||
* @param array $attributes
|
||||
* @param bool|null $secure
|
||||
* @param bool $escape
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function linkAction(
|
||||
string $action,
|
||||
string $title = null,
|
||||
array $parameters = [],
|
||||
array $attributes = [],
|
||||
bool $secure = null,
|
||||
bool $escape = true
|
||||
): HtmlString {
|
||||
return $this->link($this->url->action($action, $parameters), $title, $attributes, $secure, $escape);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a HTML link to an email address.
|
||||
*
|
||||
* @param string $email
|
||||
* @param string|null $title
|
||||
* @param array $attributes
|
||||
* @param bool $escape
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function mailto(string $email, string $title = null, array $attributes = [], bool $escape = true): HtmlString
|
||||
{
|
||||
$email = $this->email($email);
|
||||
|
||||
$title = $title ?: $email;
|
||||
|
||||
if ($escape) {
|
||||
$title = $this->entities($title);
|
||||
}
|
||||
|
||||
$email = $this->obfuscate('mailto:').$email;
|
||||
|
||||
return $this->toHtmlString('<a href="'.$email.'"'.$this->attributes($attributes).'>'.$title.'</a>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Obfuscate an e-mail address to prevent spam-bots from sniffing it.
|
||||
*
|
||||
* @param string $email
|
||||
* @return string
|
||||
*/
|
||||
public function email(string $email): string
|
||||
{
|
||||
return str_replace('@', '@', $this->obfuscate($email));
|
||||
}
|
||||
|
||||
/**
|
||||
* Obfuscate a string to prevent spam-bots from sniffing it.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function obfuscate(string $value): string
|
||||
{
|
||||
$safe = '';
|
||||
|
||||
foreach (str_split($value) as $letter) {
|
||||
if (ord($letter) > 128) {
|
||||
return $letter;
|
||||
}
|
||||
|
||||
// To properly obfuscate the value, we will randomly convert each letter to
|
||||
// its entity or hexadecimal representation, keeping a bot from sniffing
|
||||
// the randomly obfuscated letters out of the string on the responses.
|
||||
switch (random_int(1, 3)) {
|
||||
case 1:
|
||||
$safe .= '&#'.ord($letter).';';
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$safe .= '&#x'.dechex(ord($letter)).';';
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$safe .= $letter;
|
||||
}
|
||||
}
|
||||
|
||||
return $safe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates non-breaking space entities based on number supplied.
|
||||
*
|
||||
* @param int $num
|
||||
* @return string
|
||||
*/
|
||||
public function nbsp(int $num = 1): string
|
||||
{
|
||||
return str_repeat(' ', $num);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an ordered list of items.
|
||||
*
|
||||
* @param array $list
|
||||
* @param array $attributes
|
||||
* @return \Illuminate\Support\HtmlString|string
|
||||
*/
|
||||
public function ol(array $list, array $attributes = []): HtmlString|string
|
||||
{
|
||||
return $this->listing('ol', $list, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a listing HTML element.
|
||||
*
|
||||
* @param string $type
|
||||
* @param array $list
|
||||
* @param array $attributes
|
||||
* @return \Illuminate\Support\HtmlString|string
|
||||
*/
|
||||
protected function listing(string $type, array $list, array $attributes = []): HtmlString|string
|
||||
{
|
||||
$html = '';
|
||||
|
||||
if (empty($list)) {
|
||||
return $html;
|
||||
}
|
||||
|
||||
// Essentially we will just spin through the list and build the list of the HTML
|
||||
// elements from the array. We will also handled nested lists in case that is
|
||||
// present in the array. Then we will build out the final listing elements.
|
||||
foreach ($list as $key => $value) {
|
||||
$html .= $this->listingElement($key, $type, $value);
|
||||
}
|
||||
|
||||
$attributes = $this->attributes($attributes);
|
||||
|
||||
return $this->toHtmlString("<{$type}{$attributes}>{$html}</{$type}>");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the HTML for a listing element.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param string $type
|
||||
* @param mixed $value
|
||||
* @return \Illuminate\Support\HtmlString|string
|
||||
*/
|
||||
protected function listingElement(mixed $key, string $type, mixed $value): HtmlString|string
|
||||
{
|
||||
if (is_array($value)) {
|
||||
return $this->nestedListing($key, $type, $value);
|
||||
} else {
|
||||
if (is_bool($value)
|
||||
|| is_float($value)
|
||||
|| is_int($value)
|
||||
|| is_resource($value)
|
||||
|| is_string($value)
|
||||
|| is_null($value)
|
||||
) {
|
||||
return '<li>'.e(strval($value), false).'</li>';
|
||||
}
|
||||
}
|
||||
|
||||
return '<li>'.$value.'</li>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the HTML for a nested listing attribute.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param string $type
|
||||
* @param array $value
|
||||
* @return \Illuminate\Support\HtmlString|string
|
||||
*/
|
||||
protected function nestedListing(mixed $key, string $type, array $value): HtmlString|string
|
||||
{
|
||||
if (is_int($key)) {
|
||||
return $this->listing($type, $value);
|
||||
} else {
|
||||
return '<li>'.$key.$this->listing($type, $value).'</li>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an un-ordered list of items.
|
||||
*
|
||||
* @param array $list
|
||||
* @param array $attributes
|
||||
* @return \Illuminate\Support\HtmlString|string
|
||||
*/
|
||||
public function ul(array $list, array $attributes = []): HtmlString|string
|
||||
{
|
||||
return $this->listing('ul', $list, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a description list of items.
|
||||
*
|
||||
* @param array $list
|
||||
* @param array $attributes
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function dl(array $list, array $attributes = []): HtmlString
|
||||
{
|
||||
$attributes = $this->attributes($attributes);
|
||||
|
||||
$html = "<dl{$attributes}>";
|
||||
|
||||
foreach ($list as $key => $value) {
|
||||
$value = (array) $value;
|
||||
|
||||
$html .= "<dt>$key</dt>";
|
||||
|
||||
foreach ($value as $v_value) {
|
||||
$html .= "<dd>$v_value</dd>";
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '</dl>';
|
||||
|
||||
return $this->toHtmlString($html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a meta tag.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $content
|
||||
* @param array $attributes
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function meta(string $name, string $content, array $attributes = []): HtmlString
|
||||
{
|
||||
$defaults = compact('name', 'content');
|
||||
|
||||
$attributes = array_merge($defaults, $attributes);
|
||||
|
||||
return $this->toHtmlString('<meta'.$this->attributes($attributes).'>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an html tag.
|
||||
*
|
||||
* @param string $tag
|
||||
* @param mixed $content
|
||||
* @param array $attributes
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function tag(string $tag, mixed $content, array $attributes = []): HtmlString
|
||||
{
|
||||
$content = is_array($content) ? implode('', $content) : $content;
|
||||
|
||||
if (is_bool($content)
|
||||
|| is_float($content)
|
||||
|| is_int($content)
|
||||
|| is_resource($content)
|
||||
|| is_string($content)
|
||||
|| is_null($content)
|
||||
) {
|
||||
return $this->toHtmlString(
|
||||
'<'.$tag.$this->attributes($attributes).'>'.$this->toHtmlString(strval($content)).'</'.$tag.'>'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->toHtmlString('<'.$tag.$this->attributes($attributes).'>'.$content.'</'.$tag.'>');
|
||||
}
|
||||
}
|
||||
191
vendor/yajra/laravel-datatables-html/src/Html/Options/HasAjax.php
vendored
Normal file
191
vendor/yajra/laravel-datatables-html/src/Html/Options/HasAjax.php
vendored
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Options;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Yajra\DataTables\Utilities\Helper;
|
||||
|
||||
/**
|
||||
* DataTables - Data option builder.
|
||||
*
|
||||
* @see https://datatables.net/reference/option/
|
||||
*/
|
||||
trait HasAjax
|
||||
{
|
||||
/**
|
||||
* Setup "ajax" parameter with POST method.
|
||||
*
|
||||
* @param array|string $attributes
|
||||
* @return $this
|
||||
*/
|
||||
public function postAjax(array|string $attributes = ''): static
|
||||
{
|
||||
if (! is_array($attributes)) {
|
||||
$attributes = ['url' => $attributes];
|
||||
}
|
||||
|
||||
unset($attributes['method']);
|
||||
Arr::set($attributes, 'type', 'POST');
|
||||
Arr::set($attributes, 'headers.X-HTTP-Method-Override', 'GET');
|
||||
|
||||
return $this->ajax($attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup ajax parameter.
|
||||
*
|
||||
* @param array|string $attributes
|
||||
* @return $this
|
||||
*/
|
||||
public function ajax(array|string $attributes = ''): static
|
||||
{
|
||||
$this->ajax = $attributes;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
* @param string $formSelector
|
||||
* @return $this
|
||||
*/
|
||||
public function postAjaxWithForm(string $url, string $formSelector): static
|
||||
{
|
||||
$attributes = ['url' => $url];
|
||||
|
||||
Arr::set($attributes, 'type', 'POST');
|
||||
Arr::set($attributes, 'headers.X-HTTP-Method-Override', 'GET');
|
||||
|
||||
$script = $this->getScriptWithFormSelector($formSelector);
|
||||
|
||||
$attributes['data'] = "function(data) { $script }";
|
||||
|
||||
return $this->ajax($attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $formSelector
|
||||
* @return string
|
||||
*/
|
||||
protected function getScriptWithFormSelector(string $formSelector): string
|
||||
{
|
||||
return <<<CDATA
|
||||
var formData = _.groupBy($("$formSelector").find("input, select, textarea").serializeArray(), function(d) { return d.name; } );
|
||||
$.each(formData, function(i, group){
|
||||
if (group.length > 1) {
|
||||
data[group[0].name] = [];
|
||||
$.each(group, function(i, obj) {
|
||||
data[obj.name].push(obj.value)
|
||||
})
|
||||
} else {
|
||||
data[group[0].name] = group[0].value;
|
||||
}
|
||||
});
|
||||
CDATA;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup ajax parameter for datatables pipeline plugin.
|
||||
*
|
||||
* @param string $url
|
||||
* @param int $pages
|
||||
* @return $this
|
||||
* @see https://datatables.net/examples/server_side/pipeline.html
|
||||
*/
|
||||
public function pipeline(string $url, int $pages = 5): static
|
||||
{
|
||||
return $this->ajax("$.fn.dataTable.pipeline({ url: '$url', pages: $pages })");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ajax url.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAjaxUrl(): string
|
||||
{
|
||||
if (is_array($this->ajax)) {
|
||||
return $this->ajax['url'] ?: url()->current();
|
||||
}
|
||||
|
||||
return $this->ajax ?: url()->current();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ajax url with data added from form.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $formSelector
|
||||
* @return $this
|
||||
*/
|
||||
public function ajaxWithForm(string $url, string $formSelector): static
|
||||
{
|
||||
return $this->minifiedAjax($url, $this->getScriptWithFormSelector($formSelector));
|
||||
}
|
||||
|
||||
/**
|
||||
* Minify ajax url generated when using get request
|
||||
* by deleting unnecessary url params.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string|null $script
|
||||
* @param array $data
|
||||
* @param array $ajaxParameters
|
||||
* @return $this
|
||||
*/
|
||||
public function minifiedAjax(
|
||||
string $url = '',
|
||||
string $script = null,
|
||||
array $data = [],
|
||||
array $ajaxParameters = []
|
||||
): static {
|
||||
$this->ajax = [];
|
||||
$appendData = $this->makeDataScript($data);
|
||||
|
||||
$this->ajax['url'] = empty($url) ? url()->full() : $url;
|
||||
$this->ajax['type'] = 'GET';
|
||||
if (! isset($this->attributes['serverSide']) || $this->attributes['serverSide']) {
|
||||
$this->ajax['data'] = 'function(data) {
|
||||
for (var i = 0, len = data.columns.length; i < len; i++) {
|
||||
if (!data.columns[i].search.value) delete data.columns[i].search;
|
||||
if (data.columns[i].searchable === true) delete data.columns[i].searchable;
|
||||
if (data.columns[i].orderable === true) delete data.columns[i].orderable;
|
||||
if (data.columns[i].data === data.columns[i].name) delete data.columns[i].name;
|
||||
}
|
||||
delete data.search.regex;';
|
||||
} else {
|
||||
$this->ajax['data'] = 'function(data){';
|
||||
}
|
||||
|
||||
if ($appendData) {
|
||||
$this->ajax['data'] .= $appendData;
|
||||
}
|
||||
|
||||
if ($script) {
|
||||
$this->ajax['data'] .= $script;
|
||||
}
|
||||
|
||||
$this->ajax['data'] .= '}';
|
||||
|
||||
$this->ajax = array_merge($this->ajax, $ajaxParameters);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a data script to be appended on ajax request of dataTables.
|
||||
*
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
protected function makeDataScript(array $data): string
|
||||
{
|
||||
$script = '';
|
||||
foreach ($data as $key => $value) {
|
||||
$dataValue = Helper::isJavascript($value, $key) ? $value : (is_string($value) ? "'$value'" : $value);
|
||||
$script .= PHP_EOL."data.$key = $dataValue;";
|
||||
}
|
||||
|
||||
return $script;
|
||||
}
|
||||
}
|
||||
230
vendor/yajra/laravel-datatables-html/src/Html/Options/HasCallbacks.php
vendored
Normal file
230
vendor/yajra/laravel-datatables-html/src/Html/Options/HasCallbacks.php
vendored
Normal file
|
|
@ -0,0 +1,230 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Options;
|
||||
|
||||
/**
|
||||
* DataTables - Callbacks option builder.
|
||||
*
|
||||
* @see https://datatables.net/reference/option/
|
||||
*/
|
||||
trait HasCallbacks
|
||||
{
|
||||
/**
|
||||
* Set createdRow option value.
|
||||
*
|
||||
* @param string $script
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/createdRow
|
||||
*/
|
||||
public function createdRow(string $script): static
|
||||
{
|
||||
$this->attributes['createdRow'] = $script;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set drawCallback option value.
|
||||
*
|
||||
* @param string $script
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/drawCallback
|
||||
*/
|
||||
public function drawCallback(string $script): static
|
||||
{
|
||||
$this->attributes['drawCallback'] = $script;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set drawCallback option value with Livewire integration.
|
||||
* Solution as per issue https://github.com/yajra/laravel-datatables/issues/2401.
|
||||
*
|
||||
* @param string|null $script
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/drawCallback
|
||||
*/
|
||||
public function drawCallbackWithLivewire(string $script = null): static
|
||||
{
|
||||
$js = "function(settings) {
|
||||
if (window.livewire) {
|
||||
window.livewire.rescan();
|
||||
}
|
||||
|
||||
$script
|
||||
}";
|
||||
|
||||
$this->attributes['drawCallback'] = $js;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set footerCallback option value.
|
||||
*
|
||||
* @param string $script
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/footerCallback
|
||||
*/
|
||||
public function footerCallback(string $script): static
|
||||
{
|
||||
$this->attributes['footerCallback'] = $script;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set formatNumber option value.
|
||||
*
|
||||
* @param string $script
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/formatNumber
|
||||
*/
|
||||
public function formatNumber(string $script): static
|
||||
{
|
||||
$this->attributes['formatNumber'] = $script;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set headerCallback option value.
|
||||
*
|
||||
* @param string $script
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/headerCallback
|
||||
*/
|
||||
public function headerCallback(string $script): static
|
||||
{
|
||||
$this->attributes['headerCallback'] = $script;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set infoCallback option value.
|
||||
*
|
||||
* @param string $script
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/infoCallback
|
||||
*/
|
||||
public function infoCallback(string $script): static
|
||||
{
|
||||
$this->attributes['infoCallback'] = $script;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set initComplete option value.
|
||||
*
|
||||
* @param string $script
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/initComplete
|
||||
*/
|
||||
public function initComplete(string $script): static
|
||||
{
|
||||
$this->attributes['initComplete'] = $script;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set preDrawCallback option value.
|
||||
*
|
||||
* @param string $script
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/preDrawCallback
|
||||
*/
|
||||
public function preDrawCallback(string $script): static
|
||||
{
|
||||
$this->attributes['preDrawCallback'] = $script;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set rowCallback option value.
|
||||
*
|
||||
* @param string $script
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/rowCallback
|
||||
*/
|
||||
public function rowCallback(string $script): static
|
||||
{
|
||||
$this->attributes['rowCallback'] = $script;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set stateLoadCallback option value.
|
||||
*
|
||||
* @param string $script
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/stateLoadCallback
|
||||
*/
|
||||
public function stateLoadCallback(string $script): static
|
||||
{
|
||||
$this->attributes['stateLoadCallback'] = $script;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set stateLoaded option value.
|
||||
*
|
||||
* @param string $script
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/stateLoaded
|
||||
*/
|
||||
public function stateLoaded(string $script): static
|
||||
{
|
||||
$this->attributes['stateLoaded'] = $script;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set stateLoadParams option value.
|
||||
*
|
||||
* @param string $script
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/stateLoadParams
|
||||
*/
|
||||
public function stateLoadParams(string $script): static
|
||||
{
|
||||
$this->attributes['stateLoadParams'] = $script;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set stateSaveCallback option value.
|
||||
*
|
||||
* @param string $script
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/stateSaveCallback
|
||||
*/
|
||||
public function stateSaveCallback(string $script): static
|
||||
{
|
||||
$this->attributes['stateSaveCallback'] = $script;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set stateSaveParams option value.
|
||||
*
|
||||
* @param string $script
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/stateSaveParams
|
||||
*/
|
||||
public function stateSaveParams(string $script): static
|
||||
{
|
||||
$this->attributes['stateSaveParams'] = $script;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
189
vendor/yajra/laravel-datatables-html/src/Html/Options/HasColumns.php
vendored
Normal file
189
vendor/yajra/laravel-datatables-html/src/Html/Options/HasColumns.php
vendored
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Options;
|
||||
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Support\Collection;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
/**
|
||||
* DataTables - Columns option builder.
|
||||
*
|
||||
* @see https://datatables.net/reference/option/
|
||||
*/
|
||||
trait HasColumns
|
||||
{
|
||||
/**
|
||||
* Set columnDefs option value.
|
||||
*
|
||||
* @param array|\Illuminate\Contracts\Support\Arrayable|callable $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columnDefs
|
||||
*/
|
||||
public function columnDefs(array|Arrayable|callable $value): static
|
||||
{
|
||||
if (is_callable($value)) {
|
||||
$value = app()->call($value);
|
||||
}
|
||||
|
||||
if ($value instanceof Arrayable) {
|
||||
$value = $value->toArray();
|
||||
}
|
||||
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $key => $def) {
|
||||
if ($def instanceof Arrayable) {
|
||||
$value[$key] = $def->toArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->attributes['columnDefs'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a columnDef option.
|
||||
*
|
||||
* @param array|\Illuminate\Contracts\Support\Arrayable|callable $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columnDefs
|
||||
*/
|
||||
public function addColumnDef(array|Arrayable|callable $value): static
|
||||
{
|
||||
if (is_callable($value)) {
|
||||
$value = app()->call($value);
|
||||
}
|
||||
|
||||
if ($value instanceof Arrayable) {
|
||||
$value = $value->toArray();
|
||||
}
|
||||
|
||||
$this->attributes['columnDefs'][] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set columns option value.
|
||||
*
|
||||
* @param array $columns
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/columns
|
||||
*/
|
||||
public function columns(array $columns): static
|
||||
{
|
||||
$this->collection = new Collection;
|
||||
|
||||
foreach ($columns as $key => $value) {
|
||||
if (! is_a($value, Column::class)) {
|
||||
if (is_array($value)) {
|
||||
$attributes = array_merge($value, [
|
||||
'name' => $value['name'] ?? $value['data'] ?? $key,
|
||||
'data' => $value['data'] ?? $key,
|
||||
]);
|
||||
} else {
|
||||
$attributes = [
|
||||
'name' => $value,
|
||||
'data' => $value,
|
||||
];
|
||||
}
|
||||
|
||||
$this->collection->push(new Column($attributes));
|
||||
} else {
|
||||
$this->collection->push($value);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a column in collection using attributes.
|
||||
*
|
||||
* @param array|\Yajra\DataTables\Html\Column $attributes
|
||||
* @return $this
|
||||
*/
|
||||
public function addColumn(array|Column $attributes): static
|
||||
{
|
||||
if (is_array($attributes)) {
|
||||
$this->collection->push(new Column($attributes));
|
||||
} else {
|
||||
$this->add($attributes);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Column object in collection.
|
||||
*
|
||||
* @param \Yajra\DataTables\Html\Column $column
|
||||
* @return $this
|
||||
*/
|
||||
public function add(Column $column): static
|
||||
{
|
||||
$this->collection->push($column);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Column object at the beginning of collection.
|
||||
*
|
||||
* @param \Yajra\DataTables\Html\Column $column
|
||||
* @return $this
|
||||
*/
|
||||
public function addBefore(Column $column): static
|
||||
{
|
||||
$this->collection->prepend($column);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a column at the beginning of collection using attributes.
|
||||
*
|
||||
* @param array|\Yajra\DataTables\Html\Column $attributes
|
||||
* @return $this
|
||||
*/
|
||||
public function addColumnBefore(array|Column $attributes): static
|
||||
{
|
||||
if (is_array($attributes)) {
|
||||
$this->collection->prepend(new Column($attributes));
|
||||
} else {
|
||||
$this->addBefore($attributes);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get collection of columns.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection<array-key, Column>
|
||||
*/
|
||||
public function getColumns(): Collection
|
||||
{
|
||||
return $this->collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove column by name.
|
||||
*
|
||||
* @param array $names
|
||||
* @return $this
|
||||
*/
|
||||
public function removeColumn(...$names): static
|
||||
{
|
||||
foreach ($names as $name) {
|
||||
// @phpstan-ignore-next-line
|
||||
$this->collection = $this->collection->filter(function (Column $column) use ($name) {
|
||||
return $column->name !== $name;
|
||||
})->flatten();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
179
vendor/yajra/laravel-datatables-html/src/Html/Options/HasFeatures.php
vendored
Normal file
179
vendor/yajra/laravel-datatables-html/src/Html/Options/HasFeatures.php
vendored
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Options;
|
||||
|
||||
/**
|
||||
* DataTables - Features option builder.
|
||||
*
|
||||
* @see https://datatables.net/reference/option/
|
||||
*/
|
||||
trait HasFeatures
|
||||
{
|
||||
/**
|
||||
* Set autoWidth option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/autoWidth
|
||||
*/
|
||||
public function autoWidth(bool $value = true): static
|
||||
{
|
||||
$this->attributes['autoWidth'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set deferRender option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/deferRender
|
||||
*/
|
||||
public function deferRender(bool $value = true): static
|
||||
{
|
||||
$this->attributes['deferRender'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set info option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/info
|
||||
*/
|
||||
public function info(bool $value = true): static
|
||||
{
|
||||
$this->attributes['info'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set lengthChange option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/lengthChange
|
||||
*/
|
||||
public function lengthChange(bool $value = true): static
|
||||
{
|
||||
$this->attributes['lengthChange'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ordering option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/ordering
|
||||
*/
|
||||
public function ordering(bool $value = true): static
|
||||
{
|
||||
$this->attributes['ordering'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set processing option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/processing
|
||||
*/
|
||||
public function processing(bool $value = true): static
|
||||
{
|
||||
$this->attributes['processing'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set scrollX option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/scrollX
|
||||
*/
|
||||
public function scrollX(bool $value = true): static
|
||||
{
|
||||
$this->attributes['scrollX'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set scrollY option value.
|
||||
*
|
||||
* @param bool|string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/scrollY
|
||||
*/
|
||||
public function scrollY(bool|string $value = true): static
|
||||
{
|
||||
$this->attributes['scrollY'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set paging option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/paging
|
||||
*/
|
||||
public function paging(bool $value = true): static
|
||||
{
|
||||
$this->attributes['paging'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set searching option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/searching
|
||||
*/
|
||||
public function searching(bool $value = true): static
|
||||
{
|
||||
$this->attributes['searching'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set serverSide option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/serverSide
|
||||
*/
|
||||
public function serverSide(bool $value = true): static
|
||||
{
|
||||
$this->attributes['serverSide'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set stateSave option value.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/stateSave
|
||||
*/
|
||||
public function stateSave(bool $value = true): static
|
||||
{
|
||||
$this->attributes['stateSave'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
217
vendor/yajra/laravel-datatables-html/src/Html/Options/HasInternationalisation.php
vendored
Normal file
217
vendor/yajra/laravel-datatables-html/src/Html/Options/HasInternationalisation.php
vendored
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Options;
|
||||
|
||||
use Yajra\DataTables\Html\Options\Languages;
|
||||
|
||||
/**
|
||||
* DataTables - Internationalisation option builder.
|
||||
*
|
||||
* @see https://datatables.net/reference/option/
|
||||
*/
|
||||
trait HasInternationalisation
|
||||
{
|
||||
use Languages\Aria;
|
||||
use Languages\AutoFill;
|
||||
use Languages\Paginate;
|
||||
use Languages\Select;
|
||||
|
||||
/**
|
||||
* Set language decimal option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.decimal
|
||||
*/
|
||||
public function languageDecimal(string $value): static
|
||||
{
|
||||
return $this->language(['decimal' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language option value.
|
||||
*
|
||||
* @param array|string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language
|
||||
*/
|
||||
public function language(array|string $value): static
|
||||
{
|
||||
if (is_array($value)) {
|
||||
$this->attributes['language'] = array_merge((array) ($this->attributes['language'] ?? []), $value);
|
||||
} else {
|
||||
$this->attributes['language']['url'] = $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language emptyTable option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.emptyTable
|
||||
*/
|
||||
public function languageEmptyTable(string $value): static
|
||||
{
|
||||
return $this->language(['emptyTable' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language info option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.info
|
||||
*/
|
||||
public function languageInfo(string $value): static
|
||||
{
|
||||
return $this->language(['info' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language infoEmpty option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.infoEmpty
|
||||
*/
|
||||
public function languageInfoEmpty(string $value): static
|
||||
{
|
||||
return $this->language(['infoEmpty' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language infoFiltered option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.infoFiltered
|
||||
*/
|
||||
public function languageInfoFiltered(string $value): static
|
||||
{
|
||||
return $this->language(['infoFiltered' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language infoPostFix option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.infoPostFix
|
||||
*/
|
||||
public function languageInfoPostFix(string $value): static
|
||||
{
|
||||
return $this->language(['infoPostFix' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language lengthMenu option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.lengthMenu
|
||||
*/
|
||||
public function languageLengthMenu(string $value): static
|
||||
{
|
||||
return $this->language(['lengthMenu' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language loadingRecords option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.loadingRecords
|
||||
*/
|
||||
public function languageLoadingRecords(string $value): static
|
||||
{
|
||||
return $this->language(['loadingRecords' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language processing option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.processing
|
||||
*/
|
||||
public function languageProcessing(string $value): static
|
||||
{
|
||||
return $this->language(['processing' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language search option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.search
|
||||
*/
|
||||
public function languageSearch(string $value): static
|
||||
{
|
||||
return $this->language(['search' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language searchPlaceholder option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.searchPlaceholder
|
||||
*/
|
||||
public function languageSearchPlaceholder(string $value): static
|
||||
{
|
||||
return $this->language(['searchPlaceholder' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language thousands option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.thousands
|
||||
*/
|
||||
public function languageThousands(string $value): static
|
||||
{
|
||||
return $this->language(['thousands' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language url option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.url
|
||||
*/
|
||||
public function languageUrl(string $value): static
|
||||
{
|
||||
return $this->language(['url' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language zeroRecords option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.zeroRecords
|
||||
*/
|
||||
public function languageZeroRecords(string $value): static
|
||||
{
|
||||
return $this->language(['zeroRecords' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLanguage(string $key = null): mixed
|
||||
{
|
||||
if (is_null($key)) {
|
||||
return $this->attributes['language'] ?? [];
|
||||
}
|
||||
|
||||
return $this->attributes['language'][$key] ?? '';
|
||||
}
|
||||
}
|
||||
102
vendor/yajra/laravel-datatables-html/src/Html/Options/Languages/Aria.php
vendored
Normal file
102
vendor/yajra/laravel-datatables-html/src/Html/Options/Languages/Aria.php
vendored
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Options\Languages;
|
||||
|
||||
trait Aria
|
||||
{
|
||||
/**
|
||||
* Set language aria option value.
|
||||
*
|
||||
* @param array $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.aria
|
||||
*/
|
||||
public function languageAria(array $value): static
|
||||
{
|
||||
return $this->language(['aria' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language aria paginate option value.
|
||||
*
|
||||
* @param array $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.aria.paginate
|
||||
*/
|
||||
public function languageAriaPaginate(array $value): static
|
||||
{
|
||||
return $this->languageAria(['paginate' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language aria paginate first option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.aria.paginate.first
|
||||
*/
|
||||
public function languageAriaPaginateFirst(string $value): static
|
||||
{
|
||||
return $this->languageAriaPaginate(['first' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language aria paginate last option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.aria.paginate.last
|
||||
*/
|
||||
public function languageAriaPaginateLast(string $value): static
|
||||
{
|
||||
return $this->languageAriaPaginate(['last' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language aria paginate next option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.aria.paginate.next
|
||||
*/
|
||||
public function languageAriaPaginateNext(string $value): static
|
||||
{
|
||||
return $this->languageAriaPaginate(['next' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language aria paginate previous option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.aria.paginate.previous
|
||||
*/
|
||||
public function languageAriaPaginatePrevious(string $value): static
|
||||
{
|
||||
return $this->languageAriaPaginate(['previous' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language aria sortAscending option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.aria.sortAscending
|
||||
*/
|
||||
public function languageAriaSortAscending(string $value): static
|
||||
{
|
||||
return $this->languageAria(['sortAscending' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language aria sortDescending option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.aria.sortDescending
|
||||
*/
|
||||
public function languageAriaSortDescending(string $value): static
|
||||
{
|
||||
return $this->languageAria(['sortDescending' => $value]);
|
||||
}
|
||||
}
|
||||
102
vendor/yajra/laravel-datatables-html/src/Html/Options/Languages/AutoFill.php
vendored
Normal file
102
vendor/yajra/laravel-datatables-html/src/Html/Options/Languages/AutoFill.php
vendored
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Options\Languages;
|
||||
|
||||
trait AutoFill
|
||||
{
|
||||
/**
|
||||
* Set language autoFill option value.
|
||||
*
|
||||
* @param array $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.autoFill
|
||||
*/
|
||||
public function languageAutoFill(array $value): static
|
||||
{
|
||||
return $this->language(['autoFill' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language autoFill button option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.autoFill.button
|
||||
*/
|
||||
public function languageAutoFillButton(string $value): static
|
||||
{
|
||||
return $this->languageAutoFill(['button' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language autoFill cancel option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.autoFill.cancel
|
||||
*/
|
||||
public function languageAutoFillCancel(string $value): static
|
||||
{
|
||||
return $this->languageAutoFill(['cancel' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language autoFill fill option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.autoFill.fill
|
||||
*/
|
||||
public function languageAutoFillFill(string $value): static
|
||||
{
|
||||
return $this->languageAutoFill(['fill' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language autoFill fillHorizontal option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.autoFill.fillHorizontal
|
||||
*/
|
||||
public function languageAutoFillFillHorizontal(string $value): static
|
||||
{
|
||||
return $this->languageAutoFill(['fillHorizontal' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language autoFill fillVertical option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.autoFill.fillVertical
|
||||
*/
|
||||
public function languageAutoFillFillVertical(string $value): static
|
||||
{
|
||||
return $this->languageAutoFill(['fillVertical' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language autoFill increment option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.autoFill.increment
|
||||
*/
|
||||
public function languageAutoFillIncrement(string $value): static
|
||||
{
|
||||
return $this->languageAutoFill(['increment' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language autoFill info option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.autoFill.info
|
||||
*/
|
||||
public function languageAutoFillInfo(string $value): static
|
||||
{
|
||||
return $this->languageAutoFill(['info' => $value]);
|
||||
}
|
||||
}
|
||||
66
vendor/yajra/laravel-datatables-html/src/Html/Options/Languages/Paginate.php
vendored
Normal file
66
vendor/yajra/laravel-datatables-html/src/Html/Options/Languages/Paginate.php
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Options\Languages;
|
||||
|
||||
trait Paginate
|
||||
{
|
||||
/**
|
||||
* Set language aria paginate option value.
|
||||
*
|
||||
* @param array $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.paginate
|
||||
*/
|
||||
public function languagePaginate(array $value): static
|
||||
{
|
||||
return $this->language(['paginate' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language aria paginate first option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.paginate.first
|
||||
*/
|
||||
public function languagePaginateFirst(string $value): static
|
||||
{
|
||||
return $this->languagePaginate(['first' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language aria paginate last option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.paginate.last
|
||||
*/
|
||||
public function languagePaginateLast(string $value): static
|
||||
{
|
||||
return $this->languagePaginate(['last' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language aria paginate next option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.paginate.next
|
||||
*/
|
||||
public function languagePaginateNext(string $value): static
|
||||
{
|
||||
return $this->languagePaginate(['next' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language aria paginate previous option value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.paginate.previous
|
||||
*/
|
||||
public function languagePaginatePrevious(string $value): static
|
||||
{
|
||||
return $this->languagePaginate(['previous' => $value]);
|
||||
}
|
||||
}
|
||||
54
vendor/yajra/laravel-datatables-html/src/Html/Options/Languages/Select.php
vendored
Normal file
54
vendor/yajra/laravel-datatables-html/src/Html/Options/Languages/Select.php
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace Yajra\DataTables\Html\Options\Languages;
|
||||
|
||||
trait Select
|
||||
{
|
||||
/**
|
||||
* Set language select option value.
|
||||
*
|
||||
* @param array $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.select
|
||||
*/
|
||||
public function languageSelect(array $value): static
|
||||
{
|
||||
return $this->language(['select' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language select cells option value.
|
||||
*
|
||||
* @param array|string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.select.cells
|
||||
*/
|
||||
public function languageSelectCells(array|string $value): static
|
||||
{
|
||||
return $this->languageSelect(['cells' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language select columns option value.
|
||||
*
|
||||
* @param array|string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.select.columns
|
||||
*/
|
||||
public function languageSelectColumns(array|string $value): static
|
||||
{
|
||||
return $this->languageSelect(['columns' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language select rows option value.
|
||||
*
|
||||
* @param array|string $value
|
||||
* @return $this
|
||||
* @see https://datatables.net/reference/option/language.select.rows
|
||||
*/
|
||||
public function languageSelectRows(array|string $value): static
|
||||
{
|
||||
return $this->languageSelect(['rows' => $value]);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user