<commit_before>
<?php
    $view=false;
    $url = base_url()."index.php/Issues/add_issue";

    // if viewing a computer's details do these
    if(isset($computer)) {
        $view=true;
        $computer = $computer[0]; // using the first array element of the returned result
?>
    <div class="" >
        <button type="button" class="btn btn-danger btn-sm pull-right" onclick="hide_detail_view()" style="margin-right:1em; margin-top:-.5em;">
            <i class="fa fa-times fa-lg"></i>
            Close
        </button>

        <button type="button" class="btn btn-default btn-sm pull-right" onclick="enable_inputs()" style="margin-right:1em; margin-top:-.5em;">
            <i class="fa fa-pencil fa-lg"></i>
            Edit
        </button>

        <button type="button" class="btn btn-default btn-sm pull-right" onclick="show_location_history_modal()" style="margin-right:1em; margin-top:-.5em;">
            <i class="fa fa-history fa-lg"></i>
            Location History &nbsp;&nbsp;
            <span class="label label-default"><?php echo sizeof($history); ?></span>
        </button>
    </div>
<?php
    }
?>
<!-- FORM -->
    <form class="form-horizontal" <?php if($view) echo 'id="form"'; ?> role="form"  method="POST" <?php if($view) echo "onsubmit='return false;'" ?> action="<?php echo $url; ?>">
        <!-- computer ID -->
        <div class="form-group">
            <label class="col-sm-3 col-sm-offset-2 control-label no-padding-right" for="computer_id"> Computer(s) </label>

            <div class="col-sm-4">
                <select class="form-control select2" name="computers[]" multiple="multiple" data-placeholder="Select one or more" style="width: 100%;">
                    <?php
                        foreach ($computers as $computer) {
                    ?>
                        <option value="<?=$computer->computer_id ?>" <?php if($view && ($computer->location == $room->room_code)) { echo "selected"; }  ?> ><?=$computer->computer_id ?></option>
                    <?php
                        }
                    ?>
                </select>

            </div>
            <span class="text-danger">*</span>
        </div>

        <!-- Issue -->
        <div class="form-group">
            <label class="col-sm-3 col-sm-offset-2 control-label no-padding-right" for="issue"> Issue </label>

            <div class="col-sm-4">
                <input type="text" class="form-control" id="issue" name="issue" placeholder="..." value="<?php if($view) echo ($computer->processor);  ?>" required />

            </div>
            <span class="text-danger">*</span>
        </div>

        <!-- Description -->
        <div class="form-group">
            <label class="col-sm-3 col-sm-offset-2 control-label no-padding-right" for="description"> Description </label>

            <div class="col-sm-4">
                    <textarea class="form-control" id="description" name="description" placeholder="A short description of the issue"  ><?php if($view) echo ($computer->note);  ?></textarea>
            </div>
            <span class="text-danger"></span>
        </div>

        <!-- Severity -->
        <div class="form-group">
            <label class="col-sm-3 col-sm-offset-2 control-label no-padding-right" for="severity"> Severity </label>

            <div class="col-sm-4">
                <select class="form-control" name="severity" id="severity" requiredResolved by>
                    <option hidden>select one</option>
                    <option class="" value="Low"></i> Low</option>
                    <option class="text-warning" value="Medium">Medium</option>
                    <option class="text-danger" value="High">High</option>
                </select>
            </div>
            <span class="text-danger">*</span>
        </div>

        <!-- Opened by -->
        <div class="form-group">
            <label class="col-sm-3 col-sm-offset-2 control-label no-padding-right" for="resolved_by"> Issue Opened by </label>

            <div class="col-sm-3">
                <input type="text" class="form-control" id="resolved_by" name="resolved_by" value="<?php echo $this->session->userdata('username');  ?>" readonly />
            </div>
            <span class="text-danger">*</span>
        </div>

        <!-- Buttons -->
        <div class="clearfix">
            <div class="col-md-offset-5 col-md-8">
                <button class="btn btn-primary" id="save" type="submit" <?php if($view) echo "onclick='update_details(event)'"; ?> >
                    <i class="ace-icon fa fa-check bigger-110"></i>
                    Create
                </button>

                &nbsp; &nbsp;<commit_msg>Marked fields as required(select2 doesn't accept it)<commit_after>
<?php
    $view=false;
    $url = base_url()."index.php/Issues/add_issue";

    // if viewing a computer's details do these
    if(isset($computer)) {
        $view=true;
        $computer = $computer[0]; // using the first array element of the returned result
?>
    <div class="" >
        <button type="button" class="btn btn-danger btn-sm pull-right" onclick="hide_detail_view()" style="margin-right:1em; margin-top:-.5em;">
            <i class="fa fa-times fa-lg"></i>
            Close
        </button>

        <button type="button" class="btn btn-default btn-sm pull-right" onclick="enable_inputs()" style="margin-right:1em; margin-top:-.5em;">
            <i class="fa fa-pencil fa-lg"></i>
            Edit
        </button>

        <button type="button" class="btn btn-default btn-sm pull-right" onclick="show_location_history_modal()" style="margin-right:1em; margin-top:-.5em;">
            <i class="fa fa-history fa-lg"></i>
            Location History &nbsp;&nbsp;
            <span class="label label-default"><?php echo sizeof($history); ?></span>
        </button>
    </div>
<?php
    }
?>
<!-- FORM -->
    <form class="form-horizontal" <?php if($view) echo 'id="form"'; ?> role="form"  method="POST" <?php if($view) echo "onsubmit='return false;'" ?> action="<?php echo $url; ?>">
        <!-- computer ID -->
        <div class="form-group">
            <label class="col-sm-3 col-sm-offset-2 control-label no-padding-right" for="computer_id"> Computer(s) </label>

            <div class="col-sm-4">
                <select class="form-control select2" name="computers[]" multiple="multiple" data-placeholder="Select one or more" style="width: 100%;" required>
                    <?php
                        foreach ($computers as $computer) {
                    ?>
                        <option value="<?=$computer->computer_id ?>" <?php if($view && ($computer->location == $room->room_code)) { echo "selected"; }  ?> ><?=$computer->computer_id ?></option>
                    <?php
                        }
                    ?>
                </select>

            </div>
            <span class="text-danger">*</span>
        </div>

        <!-- Issue -->
        <div class="form-group">
            <label class="col-sm-3 col-sm-offset-2 control-label no-padding-right" for="issue"> Issue </label>

            <div class="col-sm-4">
                <input type="text" class="form-control" id="issue" name="issue" placeholder="..." value="<?php if($view) echo ($computer->processor);  ?>" required />

            </div>
            <span class="text-danger">*</span>
        </div>

        <!-- Description -->
        <div class="form-group">
            <label class="col-sm-3 col-sm-offset-2 control-label no-padding-right" for="description"> Description </label>

            <div class="col-sm-4">
                    <textarea class="form-control" id="description" name="description" placeholder="A short description of the issue"  required><?php if($view) echo ($computer->note);  ?></textarea>
            </div>
            <span class="text-danger"></span>
        </div>

        <!-- Severity -->
        <div class="form-group">
            <label class="col-sm-3 col-sm-offset-2 control-label no-padding-right" for="severity"> Severity </label>

            <div class="col-sm-4">
                <select class="form-control" name="severity" id="severity" required>
                    <option hidden>select one</option>
                    <option class="" value="Low"></i> Low</option>
                    <option class="text-warning" value="Medium">Medium</option>
                    <option class="text-danger" value="High">High</option>
                </select>
            </div>
            <span class="text-danger">*</span>
        </div>

        <!-- Opened by -->
        <div class="form-group">
            <label class="col-sm-3 col-sm-offset-2 control-label no-padding-right" for="resolved_by"> Issue Opened by </label>

            <div class="col-sm-3">
                <input type="text" class="form-control" id="resolved_by" name="resolved_by" value="<?php echo $this->session->userdata('username');  ?>" readonly />
            </div>
            <span class="text-danger">*</span>
        </div>

        <!-- Buttons -->
        <div class="clearfix">
            <div class="col-md-offset-5 col-md-8">
                <button class="btn btn-primary" id="save" type="submit" <?php if($view) echo "onclick='update_details(event)'"; ?> >
                    <i class="ace-icon fa fa-check bigger-110"></i>
                    Create
                </button>

                &nbsp; &nbsp;
{'fraction_non_alphanumeric': 0.17859035506094328, 'fraction_numerical': 0.006677265500794912, 'mean_word_length': 2.0253286309714653, 'pattern_counts': {'":': 0, '<': 211, '<?xml version=': 0, '>': 227, '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': '4648096', 'n_tokens_mistral': 2785, 'n_tokens_neox': 2644, 'n_words': 595}