<commit_before>@extends('lcm::layouts/master')

@section('title', $class." - form")

@section('page-title', strtoupper($class)." MANAGEMENT")

@section('content')
<div class="row">
    <div class="col-md-12">
        <div class="box">
            <div class="box-header with-border">
                <a href="{{url('lcm/gen/'.$class)}}" class="box-title">Master</a> >
                <span class="box-title">{{ ($model) ? 'Edit' : 'Create' }} Form</span>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
                <div class="row">
                    <div class="col-md-12">
                        <div class="box box-primary">
                            <div class="box-header with-border">
                                <h3 class="box-title"></h3>
                            </div>
                            <!-- /.box-header -->
                            <div class="box-body">
                            
                                @if($model[$model->getKeyName()])
                                    {!! Form::model($model, ['url' => url('lcm/gen/'.$class.'/1'), 'method'=>'post', 'files' => true]) !!}
                                @else
                                    {!! Form::model('', ['url' => url('lcm/gen/'.$class), 'method'=>'post', 'files' => true]) !!}
                                @endif

                                @foreach ($schemes as $scheme)
                                    @if(strpos($scheme->Extra, 'auto_increment') === false && !in_array($scheme->Field, $lcm['hides']))

                                        <?php $readOnly = (in_array($scheme->Field, $lcm['readOnly'])) ? 'readonly' : '' ?>

                                        @if(!$model[$scheme->Field] && $scheme->Default != '')
                                            @if($scheme->Default == 'CURRENT_TIMESTAMP')
                                                <?php
                                                    $mytime = Carbon\Carbon::now();
                                                    $model->{$scheme->Field} = $mytime->toDateTimeString();
                                                ?>
                                            @else
                                                <?php $model->{$scheme->Field} = $scheme->Default; ?>                                                
                                            @endif
                                        @endif

                                        @if(in_array($scheme->Field, $lcm['files']))
                                            <div class="form-group {!! $errors->has($scheme->Field) ? 'has-error' : '' !!}">
                                                {!! Form::label($scheme->Field, str_replace("_", " ", $scheme->Field)) !!}
                                                {!! Form::file($scheme->Field, $model[$scheme->Field], ['class' => 'form-control', $readOnly]) !!}
                                                {!! $errors->first($scheme->Field, '<p class="help-block">:message</p>') !!}
                                            </div>
                                        @elseif(strpos($scheme->Key, 'MUL') !== false)
                                            <div class="form-group {!! $errors->has($scheme->Field) ? 'has-error' : '' !!}">
                                                <?php 
                                                    $reference = $model->getReference($scheme->Field);
                                                    $referencedClass = '\\App\\Models\\'.studly_case(str_singular($reference->REFERENCED_TABLE_NAME));
                                                    $referencedClassLcm = isset($model::$lcm) ? array_merge($model::$lcmGlobal, $model::$lcm) : $model::$lcmGlobal;
                                                ?>
                                                {!! Form::label($scheme->Field, str_replace("_", " ", $scheme->Field)) !!}
                                                {!! Form::select($scheme->Field, ['' => '---']+$referencedClass::lists($referencedClassLcm['columnLabel'],'id')->all(), null, ['id'=>$scheme->Field, 'class' => 'form-control', $readOnly]) !!}
                                                {!! $errors->first($scheme->Field, '<p class="help-block">:message</p>') !!}      
                                            </div>                      
                                        @elseif(strpos($scheme->Type, 'char') !== false)
                                            <div class="form-group {!! $errors->has($scheme->Field) ? 'has-error' : '' !!}">
                                                {!! Form::label($scheme->Field, str_replace("_", " ", $scheme->Field)) !!}
                                                {!! Form::text($scheme->Field, $model[$scheme->Field], ['class' => 'form-control', $readOnly]) !!}
                                                {!! $errors->first($scheme->Field, '<p class="help-block">:message</p>') !!}
                                            </div>
                                        @elseif(strpos($scheme->Type, 'text') !== false)
                                            <div class="form-group {!! $errors->has($scheme->Field) ? 'has-error' : '' !!}">
                                                {!! Form::label($scheme->Field, str_replace("_", " ", $scheme->Field)) !!}
                                                {!! Form::textarea($scheme->Field, $model[$scheme->Field], ['class' => 'form-control', $readOnly]) !!}
                                                {!! $errors->first($scheme->Field, '<p class="help-block">:message</p>') !!}
                                            </div>
                                        @elseif(strpos($scheme->Type, 'int') !== false)
                                            <div class="form-group {!! $errors->has($scheme->Field) ? 'has-error' : '' !!}">
                                                {!! Form::label($scheme->Field, str_replace("_", " ", $scheme->Field)) !!}
                                                {!! Form::number($scheme->Field, $model[$scheme->Field], ['class' => 'form-control', $readOnly]) !!}
                                                {!! $errors->first($scheme->Field, '<p class="help-block">:message</p>') !!}
                                            </div><commit_msg>bug fix for incorrect referenced class<commit_after>@extends('lcm::layouts/master')

@section('title', $class." - form")

@section('page-title', strtoupper($class)." MANAGEMENT")

@section('content')
<div class="row">
    <div class="col-md-12">
        <div class="box">
            <div class="box-header with-border">
                <a href="{{url('lcm/gen/'.$class)}}" class="box-title">Master</a> >
                <span class="box-title">{{ ($model) ? 'Edit' : 'Create' }} Form</span>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
                <div class="row">
                    <div class="col-md-12">
                        <div class="box box-primary">
                            <div class="box-header with-border">
                                <h3 class="box-title"></h3>
                            </div>
                            <!-- /.box-header -->
                            <div class="box-body">
                            
                                @if($model[$model->getKeyName()])
                                    {!! Form::model($model, ['url' => url('lcm/gen/'.$class.'/1'), 'method'=>'post', 'files' => true]) !!}
                                @else
                                    {!! Form::model('', ['url' => url('lcm/gen/'.$class), 'method'=>'post', 'files' => true]) !!}
                                @endif

                                @foreach ($schemes as $scheme)
                                    @if(strpos($scheme->Extra, 'auto_increment') === false && !in_array($scheme->Field, $lcm['hides']))

                                        <?php $readOnly = (in_array($scheme->Field, $lcm['readOnly'])) ? 'readonly' : '' ?>

                                        @if(!$model[$scheme->Field] && $scheme->Default != '')
                                            @if($scheme->Default == 'CURRENT_TIMESTAMP')
                                                <?php
                                                    $mytime = Carbon\Carbon::now();
                                                    $model->{$scheme->Field} = $mytime->toDateTimeString();
                                                ?>
                                            @else
                                                <?php $model->{$scheme->Field} = $scheme->Default; ?>                                                
                                            @endif
                                        @endif

                                        @if(in_array($scheme->Field, $lcm['files']))
                                            <div class="form-group {!! $errors->has($scheme->Field) ? 'has-error' : '' !!}">
                                                {!! Form::label($scheme->Field, str_replace("_", " ", $scheme->Field)) !!}
                                                {!! Form::file($scheme->Field, $model[$scheme->Field], ['class' => 'form-control', $readOnly]) !!}
                                                {!! $errors->first($scheme->Field, '<p class="help-block">:message</p>') !!}
                                            </div>
                                        @elseif(strpos($scheme->Key, 'MUL') !== false)
                                            <div class="form-group {!! $errors->has($scheme->Field) ? 'has-error' : '' !!}">
                                                <?php 
                                                    $reference = $model->getReference($scheme->Field);
                                                    $referencedClass = '\\App\\Models\\'.studly_case(str_singular($reference->REFERENCED_TABLE_NAME));
                                                    $referencedClassLcm = isset($referencedClass::$lcm) ? array_merge($referencedClass::$lcmGlobal, $referencedClass::$lcm) : $referencedClass::$lcmGlobal;
                                                ?>
                                                {!! Form::label($scheme->Field, str_replace("_", " ", $scheme->Field)) !!}
                                                {!! Form::select($scheme->Field, ['' => '---']+$referencedClass::lists($referencedClassLcm['columnLabel'],'id')->all(), null, ['id'=>$scheme->Field, 'class' => 'form-control', $readOnly]) !!}
                                                {!! $errors->first($scheme->Field, '<p class="help-block">:message</p>') !!}      
                                            </div>                      
                                        @elseif(strpos($scheme->Type, 'char') !== false)
                                            <div class="form-group {!! $errors->has($scheme->Field) ? 'has-error' : '' !!}">
                                                {!! Form::label($scheme->Field, str_replace("_", " ", $scheme->Field)) !!}
                                                {!! Form::text($scheme->Field, $model[$scheme->Field], ['class' => 'form-control', $readOnly]) !!}
                                                {!! $errors->first($scheme->Field, '<p class="help-block">:message</p>') !!}
                                            </div>
                                        @elseif(strpos($scheme->Type, 'text') !== false)
                                            <div class="form-group {!! $errors->has($scheme->Field) ? 'has-error' : '' !!}">
                                                {!! Form::label($scheme->Field, str_replace("_", " ", $scheme->Field)) !!}
                                                {!! Form::textarea($scheme->Field, $model[$scheme->Field], ['class' => 'form-control', $readOnly]) !!}
                                                {!! $errors->first($scheme->Field, '<p class="help-block">:message</p>') !!}
                                            </div>
                                        @elseif(strpos($scheme->Type, 'int') !== false)
                                            <div class="form-group {!! $errors->has($scheme->Field) ? 'has-error' : '' !!}">
                                                {!! Form::label($scheme->Field, str_replace("_", " ", $scheme->Field)) !!}
                                                {!! Form::number($scheme->Field, $model[$scheme->Field], ['class' => 'form-control', $readOnly]) !!}
                                                {!! $errors->first($scheme->Field, '<p class="help-block">:message</p>') !!}
                                            </div>
{'fraction_non_alphanumeric': 0.1766478633799552, 'fraction_numerical': 0.0010818329340854648, 'mean_word_length': 1.0083798882681565, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 243, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 180, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4098225', 'n_tokens_mistral': 2792, 'n_tokens_neox': 2770, 'n_words': 396}