<commit_before><?php
// Required Fields: $item (eg Player), $fields[], $url (The url to post items to).
// Optional Fields: $hidden_fields, $modal_id, $flash_id,

$trimmed_item = strpos($item, ' ') !== false ? join('', explode(' ', $item)) : $item;

if (!isset($modal_id)) {
    $modal_id = "create{$trimmed_item}Modal";
}

if (!isset($url)) {
    $url = route('crudapi.store', $item);
}
?>
<script>
    function create<?php echo ucfirst($trimmed_item); ?>()
    {
        /* Disable the create project modal button */
        $('.create-<?php echo lcfirst($trimmed_item); ?>').prop( "disabled", true );

        var data = {
            @foreach($fields as $f)
            "{{ $f }}": $('#{{$f}}').val(),
            @endforeach

            "_token": "{{ csrf_token() }}"
        }

        /* Send the post request */
        @if(isset($done))
            $.post( "{{ $url }}", data, function() {
            <?php echo $done; ?>
        });
        @else
            $.post("{{ $url }}", data);
        @endif

        /* Enable the button in case of failure */
        //$('.create-<?php echo lcfirst($trimmed_item); ?>').prop( "disabled", false );
    }
</script>
<div class="modal fade" id="<?=$modal_id;?>" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">Create {{ $item }}</h4>
            </div>
            <div class="modal-body">
                @if (isset($flash_id))
                    <div id="{{ $flash_id }}" class="alert" style="display: none;"></div><commit_msg>Update _createModal.blade.php<commit_after><?php
// Required Fields: $item (eg Player), $fields[], $url (The url to post items to).
// Optional Fields: $hidden_fields, $modal_id, $flash_id, $title

$trimmed_item = strpos($item, ' ') !== false ? join('', explode(' ', $item)) : $item;

if (!isset($modal_id)) {
    $modal_id = "create{$trimmed_item}Modal";
}

if (!isset($title)) {
    $title = 'Create ' . $item;
}

if (!isset($url)) {
    $url = route('crudapi.store', $item);
}
?>
<script>
    function create<?php echo ucfirst($trimmed_item); ?>()
    {
        /* Disable the create project modal button */
        $('.create-<?php echo lcfirst($trimmed_item); ?>').prop( "disabled", true );

        var data = {
            @foreach($fields as $f)
            "{{ $f }}": $('#{{$f}}').val(),
            @endforeach

            "_token": "{{ csrf_token() }}"
        }

        /* Send the post request */
        @if(isset($done))
            $.post( "{{ $url }}", data, function() {
            <?php echo $done; ?>
        });
        @else
            $.post("{{ $url }}", data);
        @endif

        /* Enable the button in case of failure */
        //$('.create-<?php echo lcfirst($trimmed_item); ?>').prop( "disabled", false );
    }
</script>
<div class="modal fade" id="<?=$modal_id;?>" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">{{ $title }}</h4>
            </div>
            <div class="modal-body">
                @if (isset($flash_id))
                    <div id="{{ $flash_id }}" class="alert" style="display: none;"></div>
{'fraction_non_alphanumeric': 0.21416712783619257, 'fraction_numerical': 0.0016602102933038186, 'mean_word_length': 2.3975563909774436, 'pattern_counts': {'":': 4, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '668560', 'n_tokens_mistral': 1136, 'n_tokens_neox': 1117, 'n_words': 260}