';
foreach ($TableCols as $key => $TableCol) :
$TableCol = $TableCol->Field;
if ($key == 0 || $TableCol == 'createdOn' || $TableCol == 'createdBy' || $TableCol == 'updatedBy' || $TableCol == 'created_at' || $TableCol == 'updated_at')
continue;
$TableColLabel = ucwords(str_replace("_", " ", $TableCol));
$editContent .= '
';
if ($TableCol == 'status')
$editContent .= "{{customCreateSelect(\"$TableCol\",\"$TableCol\",'',\"$TableColLabel\",['1'=>'Active','0'=>'Inactive'],\$data->$TableCol)}}\n";
else
$editContent .= "{{createText(\"$TableCol\",\"$TableCol\",\"$TableColLabel\",'',\$data->$TableCol)}}\n";
$editContent .= "
";
endforeach;
$editContent .= '
';
$editContent .= "\n";
$editContent .= "
";
$editContent .= " ";
$path = base_path() . "/resources/views/dftqc/$folder/ajax/";
$file = $path . "simple_edit.blade.php";
if (!file_exists("$path")) {
mkdir("$path", 0777, true);
}
if (!file_exists($file)) {
$file = fopen($file, 'w');
fwrite($file, $editContent);
fclose($file);
}
return $editContent;
} //end of ajaxEditContent method
public static function showContent($TableName, $directoryName){
$TableCols = DB::select("describe " . $TableName);
$TableRows = DB::select("select * from " . $TableName);
$folder = '';
$routeName = '';
if (!empty($directoryName)) {
$folder .= strtolower($directoryName) . '/';
$routeName .= strtolower($directoryName) . '.';
}
$routeName .= strtolower(str_replace("tbl_", "", $TableName));
$folder .= str_replace("tbl_", "", $TableName);
$Table_pk = str_replace("tbl_", "", $TableName) . "_id";
$title = ucwords(str_replace("tbl_", "", $TableName));
$showContent = "@extends('dftqc.partials.layouts')
@section('content')
\n";
$showContent .= "@include('dftqc.".$routeName.".ajax.show')";
$showContent .= "
@endSection";
$path = base_path() . "/resources/views/dftqc/$folder/";
$file = $path . "show.blade.php";
if (!file_exists("$path")) {
mkdir("$path", 0777, true);
}
if (!file_exists($file)) {
$file = fopen($file, 'w');
fwrite($file, $showContent);
fclose($file);
}
return $showContent;
}
public static function ajaxShowContent($TableName, $directoryName)
{
$TableCols = DB::select("describe " . $TableName);
$TableRows = DB::select("select * from " . $TableName);
$folder = '';
$routeName = '';
if (!empty($directoryName)) {
$folder .= strtolower($directoryName) . '/';
$routeName .= strtolower($directoryName) . '.';
}
$routeName .= strtolower(str_replace("tbl_", "", $TableName));
$folder .= str_replace("tbl_", "", $TableName);
$Table_pk = str_replace("tbl_", "", $TableName) . "_id";
$title = ucwords(str_replace("tbl_", "", $TableName));
$showContent = "
{{ label('$title Details') }}
{{-- --}}
{{\$data['" . $TableCols['1']->Field . "']}}
";
foreach ($TableCols as $key => $TableCol) :
$TableCol = $TableCol->Field;
if ($key == 0 || $TableCol == 'createdOn' || $TableCol == 'createdBy' || $TableCol == 'updatedBy' || $TableCol == 'created_at' || $TableCol == 'updated_at')
continue;
$TableColLabel = ucwords(str_replace("_", " ", $TableCol));
if ($TableCol == 'status')
$showContent .= "
Status : $TableCol == 1 ? 'text-success' : 'text-danger'}}\">{{\$data->$TableCol == 1 ? 'Active' : 'Inactive'}}
";
else
$showContent .= '
' . $TableColLabel . " : {{\$data->$TableCol}}
";
endforeach;
$showContent .= "
Created On : {{\$data->created_at}}
Created By : {{\$data->createdBy}}
Updated On : {{\$data->updated_at}}
Updated By : {{\$data->updatedBy}}
";
$path = base_path() . "/resources/views/dftqc/$folder/ajax/";
$file = $path . "show.blade.php";
if (!file_exists("$path")) {
mkdir("$path", 0777, true);
}
if (!file_exists($file)) {
$file = fopen($file, 'w');
fwrite($file, $showContent);
fclose($file);
}
return $showContent;
}
public static function dataTable($TableRows, $TableName)
{
$Table_pk = str_replace("tbl_", "", $TableName) . "_id";
$TableCols = array_keys((array)$TableRows[0]);
//BibClass::pre($TableCols);
?>
Field;
switch ($tableField) {
case $Table_pk:
case 'status':
case 'created_at':
case 'updated_at':
break;
default:
createInput("text", $tableField, $tableField, $tableField, "", "", "");
}
}
}
}