<?php $__env->startSection('title', $title); ?>


<!-- BEGIN PAGE CSS -->
<?php $__env->startSection('page-css'); ?>
    <style>
        .toggle-code-snippet {
            margin-bottom: 0px;
        }

        body.dark .toggle-code-snippet {
            margin-bottom: 0px;
        }
    </style>
    <link href="/cork/src/assets/css/light/scrollspyNav.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="/cork/src/plugins/css/light/editors/markdown/simplemde.min.css">
    <link href="/cork/src/assets/css/dark/scrollspyNav.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="/cork/src/plugins/css/dark/editors/markdown/simplemde.min.css">
<?php $__env->stopSection(); ?>
<!-- END PAGE CSS -->

<!-- BREADCRUMB -->
<?php $__env->startSection('breadcrumb'); ?>
    <div class="page-meta">
        <nav class="breadcrumb-style-one" aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="<?php echo e(route('dashboard')); ?>">Home</a></li>
                <li class="breadcrumb-item"><a href="<?php echo e(route('welcome-letters.index')); ?>">Welcome Letters</a></li>
                <li class="breadcrumb-item active" aria-current="page"><?php echo e($title); ?></li>
            </ol>
        </nav>
    </div>
    <!-- /BREADCRUMB -->
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <form method="post"
        action="<?php if($action == 'create'): ?> <?php echo e(route('welcome-letters.store')); ?> <?php else: ?> <?php echo e(route('welcome-letters.update', $welcomeLetter->id)); ?> <?php endif; ?>"
        enctype="multipart/form-data">
        <?php echo csrf_field(); ?>
        <?php if($action == 'edit'): ?>
            <?php echo method_field('PUT'); ?>
        <?php endif; ?>
        <div class="form-group">

            <label for="section_id">Section*</label>
            <div class="form-row">
                <div class="col-md-4 mb-4" id="section_id">
                    <select name="section_id" id="section_id" class="form-select <?php $__errorArgs = ['section_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>">
                        <?php $__currentLoopData = $sections; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php $s = App\Models\Section::find($s->id); ?>
                            <option value="<?php echo e($s->id); ?>" <?php if(@isset($welcomeLetter->section_id) && $s->id === $welcomeLetter->section_id): ?> selected <?php endif; ?>>
                                <?php echo e($s->provider->name); ?> - <?php echo e($s->course->name); ?> - <?php echo e($s->teacher->last_name); ?> -
                                <?php echo e($s->year->year); ?> <?php echo e($s->termDesc()); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>

                    <?php $__errorArgs = ['section_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <div class="invalid-feedback" style="display: block !important;">
                            <?php echo e($errors->first('section_id')); ?>

                        </div>
                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>
            </div>
            <label for="section_id">Text*</label>
            <div class="form-row">
                <div class="col-md-8 mb-4" id="text-div">
                    <textarea id="text" name="text">
                        <?php if(isset($welcomeLetter->text)): ?>
<?php echo e($welcomeLetter->text); ?>

<?php else: ?>
<?php echo e(old('text')); ?>

<?php endif; ?>
                    </textarea>
                </div>
            </div>
            <button class="btn btn-outline-info mb-2 me-4" style="text-align: left">You may add up to 3 attachments that
                automatically send with
                your
                welcome letter
                (syllabus, materials
                list,
                etc.). Give each file a title as that is
                what the files will be named as on the email attachments. <strong>No need to attach the calendar as that
                    will be done
                    automatically.</strong></button>
            <label for="file1">File 1</label>
            <div class="form-row">
                <?php if(isset($welcomeLetter->file1)): ?>
                    <div class="col-md-8 mb-4" id="file1Link">
                        <p>Current File: <a
                                href="/uploads/welcome-letter-files/<?php echo e($welcomeLetter->file1); ?>"><?php echo e($welcomeLetter->file1); ?></a>
                        </p>
                        <input type="hidden" id="file1_old" name="file1_old" value="<?php echo e($welcomeLetter->file1); ?>" />
                        <button type="button" onclick="toggleFile1()">Remove File</button>
                    </div>
                    <div class="col-md-8 mb-4" id="file1Upload"
                        style="<?php echo e(isset($welcomeLetter->file1) ? 'display: none;' : ''); ?>">
                        <input type="file" name="file1" id="file1" />
                    </div>
                <?php else: ?>
                    <div class="col-md-8 mb-4" id="file1Upload">
                        <input type="file" name="file1" id="file1" />
                    </div>
                <?php endif; ?>
                <div class="form-row">
                    <label for="file1_title">File 1 Title</label>
                    <div class="col-md-4 mb-4">
                        <input type="text" class="form-control <?php $__errorArgs = ['file1_title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                            name="file1_title" id="file1_title" aria-describedby="basic-addon3" placeholder="File 1 Title"
                            maxlength="100"
                            <?php if(isset($welcomeLetter->file1_title)): ?> value="<?php echo e($welcomeLetter->file1_title); ?>" <?php else: ?> value="<?php echo e(old('file1_title')); ?>" <?php endif; ?>>
                        <?php $__errorArgs = ['file1_title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="invalid-feedback" style="display: block !important;">
                                <?php echo e($errors->first('file1_title')); ?>

                            </div>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>
                </div>
            </div>
        </div>
        <label for="file2">File 2</label>
        <div class="form-row">
            <?php if(isset($welcomeLetter->file2)): ?>
                <div class="col-md-8 mb-4" id="file2Link">
                    <p>Current File: <a
                            href="/uploads/welcome-letter-files/<?php echo e($welcomeLetter->file2); ?>"><?php echo e($welcomeLetter->file2); ?></a>
                    </p>
                    <input type="hidden" id="file2_old" name="file2_old" value="<?php echo e($welcomeLetter->file2); ?>" />
                    <button type="button" onclick="toggleFile2()">Remove File</button>
                </div>
                <div class="col-md-8 mb-4" id="file2Upload"
                    style="<?php echo e(isset($welcomeLetter->file2) ? 'display: none;' : ''); ?>">
                    <input type="file" name="file2" id="file2" />
                </div>
            <?php else: ?>
                <div class="col-md-8 mb-4" id="file2Upload">
                    <input type="file" name="file2" id="file2" />
                </div>
            <?php endif; ?>
            <div class="form-row">
                <label for="file2_title">File 2 Title</label>
                <div class="col-md-4 mb-4">
                    <input type="text" class="form-control <?php $__errorArgs = ['file2_title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                        name="file2_title" id="file2_title" aria-describedby="basic-addon3" placeholder="File 2 Title"
                        maxlength="100"
                        <?php if(isset($welcomeLetter->file2_title)): ?> value="<?php echo e($welcomeLetter->file2_title); ?>" <?php else: ?> value="<?php echo e(old('file2_title')); ?>" <?php endif; ?>>
                    <?php $__errorArgs = ['file2_title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <div class="invalid-feedback" style="display: block !important;">
                            <?php echo e($errors->first('file2_title')); ?>

                        </div>
                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>
            </div>
        </div>
        <label for="file3">File 3</label>
        <div class="form-row">
            <?php if(isset($welcomeLetter->file3)): ?>
                <div class="col-md-8 mb-4" id="file3Link">
                    <p>Current File: <a
                            href="/uploads/welcome-letter-files/<?php echo e($welcomeLetter->file3); ?>"><?php echo e($welcomeLetter->file3); ?></a>
                    </p>
                    <input type="hidden" id="file3_old" name="file3_old" value="<?php echo e($welcomeLetter->file3); ?>" />
                    <button type="button" onclick="toggleFile3()">Remove File</button>
                </div>
                <div class="col-md-8 mb-4" id="file3Upload"
                    style="<?php echo e(isset($welcomeLetter->file3) ? 'display: none;' : ''); ?>">
                    <input type="file" name="file3" id="file3" />
                </div>
            <?php else: ?>
                <div class="col-md-8 mb-4" id="file3Upload">
                    <input type="file" name="file3" id="file3" />
                </div>
            <?php endif; ?>
            <div class="form-row">
                <label for="file3_title">File 3 Title</label>
                <div class="col-md-4 mb-4">
                    <input type="text" class="form-control <?php $__errorArgs = ['file3_title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                        name="file3_title" id="file3_title" aria-describedby="basic-addon3" placeholder="File 3 Title"
                        maxlength="100"
                        <?php if(isset($welcomeLetter->file3_title)): ?> value="<?php echo e($welcomeLetter->file3_title); ?>" <?php else: ?> value="<?php echo e(old('file3_title')); ?>" <?php endif; ?>>
                    <?php $__errorArgs = ['file3_title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <div class="invalid-feedback" style="display: block !important;">
                            <?php echo e($errors->first('file3_title')); ?>

                        </div>
                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>
            </div>

        </div>
        <div class="form-row">
            <button type="submit" class="mt-4 btn btn-primary">Submit</button>
            <button type="button" class="mt-4 ml-4 btn btn-secondary"
                onclick="window.history.go(-1); return false;">Cancel</button>
        </div>
        </div>
    </form>
<?php $__env->stopSection(); ?>
<!--  BEGIN PAGE SCRIPTS FILE  -->
<?php $__env->startSection('page-js'); ?>
    <script src="/cork/src/assets/js/scrollspyNav.js"></script>
    <script src="https://cdn.ckeditor.com/ckeditor5/41.4.1/classic/ckeditor.js"></script>
    <script>
        ClassicEditor
            .create(document.querySelector('#text'))
            .catch(error => {
                console.error(error);
            });

        function toggleFile1() {
            document.getElementById('file1Link').style.display = 'none';
            document.getElementById('file1Upload').style.display = 'block';
        }

        function toggleFile2() {
            document.getElementById('file2Link').style.display = 'none';
            document.getElementById('file2Upload').style.display = 'block';
        }

        function toggleFile3() {
            document.getElementById('file3Link').style.display = 'none';
            document.getElementById('file3Upload').style.display = 'block';
        }
    </script>
<?php $__env->stopSection(); ?>
<!--  END PAGE SCRIPTS FILE  -->

<?php echo $__env->make('layouts.cork', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/psjybwmy/public_html/registration/resources/views/admin/welcome-letters/form.blade.php ENDPATH**/ ?>