
<?php $__env->startSection('content'); ?>
    <style>
        .profile-pic {
            width: 150px;
            height: 150px;
            display: inline-block;
            border: #ccc 1px solid;
            padding: 1px;
        }

        .file-upload {
            display: none;
        }

        img {
            max-width: 100%;
            height: auto;
        }

        .p-image {
            top: 120px;
            left: 58px;
            color: #666666;
            transition: all .3s cubic-bezier(.175, .885, .32, 1.275);
        }

        .p-image:hover {
            transition: all .3s cubic-bezier(.175, .885, .32, 1.275);
        }

        .upload-button {
            font-size: 1.2em;
        }

        .upload-button:hover {
            transition: all .3s cubic-bezier(.175, .885, .32, 1.275);
            color: #999;
        }
    </style>
    <!-- begin::main content -->
    <main class="main-content">
        <div class="container">
            <!-- begin::page header -->
            <div class="page-header">
                <h3>Notification</h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="<?php echo e(asset('dashboard')); ?>"><?php echo e(__('message.dashboard')); ?></a></li>
                        <li class="breadcrumb-item"><a href="<?php echo e(asset('hrms\notification')); ?>">Notification</a></li>
                        <li class="breadcrumb-item active" aria-current="page"><?php echo e(__('message.add')); ?></li>
                    </ol>
                </nav>
            </div>
            <!-- end::page header -->
            <?php if (isset($component)) { $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\FlashMessage::class, []); ?>
<?php $component->withName('flashMessage'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74)): ?>
<?php $component = $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74; ?>
<?php unset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74); ?>
<?php endif; ?>
            <?php if(count($errors) > 0): ?>
                <?php $__currentLoopData = $errors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php echo e($error); ?>

                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            <?php endif; ?>
            

            <form class="needs-validation" enctype="multipart/form-data" method="POST" action="<?php echo e(asset('hrms/save-notification')); ?>" >
                <?php echo csrf_field(); ?>
                <div class="row">
                    <div class="col-md-12">
                       
                        <div class="card">
                            <div class="card-body">
                                
                                <a href="<?php echo e(asset('notification')); ?>"
                                    class="btn btn-primary pull-right  text-white waves-effect waves-button waves-light"><i
                                        class="fa fa-list"></i>&nbsp;<?php echo e(__('message.notification')); ?> <?php echo e(__('message.list')); ?></a>
                                <h6 class="card-title">Notification Information</h6>

                                <div class="form-row">
                                    <div class="col-md-6">
                                        <div class="col-md-12 mb-3">
                                            <label for="heading">Branch<span class="text-danger">*</span></label>

                                                <select name="branch_id" class="form-control">
                                                    <option selected disabled>SELECT</option>
                                                    <?php $__currentLoopData = $branches; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option value="<?php echo e($value->id); ?>"><?php echo e($value->school); ?></option>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </select>
                                            <?php if($errors->has('branch_id')): ?>
                                                <div class="invalid-feedback">
                                                    <?php echo e($errors->first('branch_id')); ?>

                                                </div>
                                            <?php endif; ?>
                                        </div>
                                        <div class="col-md-12 mb-3">
                                            <label for="heading">Department<span class="text-danger">*</span></label>

                                                <select name="department_id" class="form-control department_change">
                                                    <option selected disabled>SELECT</option>
                                                    <?php $__currentLoopData = $department; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option value="<?php echo e($value->id); ?>"><?php echo e($value->name); ?></option>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </select>
                                            <?php if($errors->has('department_id')): ?>
                                                <div class="invalid-feedback">
                                                    <?php echo e($errors->first('department')); ?>

                                                </div>
                                            <?php endif; ?>
                                        </div>

                                        <div class="col-md-12 mb-3">
                                            <label for="heading">Type<span class="text-danger">*</span></label>

                                                <select name="type" class="form-control ">
                                                    <option value="single">Employee</option>
                                                    <option value="all">All</option>
                                                    
                                                </select>
                                            <?php if($errors->has('type')): ?>
                                                <div class="invalid-feedback">
                                                    <?php echo e($errors->first('type')); ?>

                                                </div>
                                            <?php endif; ?>
                                        </div>

                                        <div class="col-md-12 mb-3">                                        
                                            <label for="name">Employee</label>
                                            <select name="user_unique_id" class="form-control select2 text-capitalize employee_select" >
                                                
                                            </select>                                                    
                                        </div>

                                        <div class="col-md-12 mb-3">
                                            <label for="heading">Title<span class="text-danger">*</span></label>

                                                <input type="text" name="title" class="form-control <?php echo e($errors->has('heading') ? 'is-invalid' : ''); ?>">
                                            <?php if($errors->has('title')): ?>
                                                <div class="invalid-feedback">
                                                    <?php echo e($errors->first('title')); ?>

                                                </div>
                                            <?php endif; ?>
                                        </div>
                                        
                                        <div class="col-md-12 mb-3">
                                            <label for="description"><?php echo e(__('message.description')); ?><span class="text-danger">*</span></label>
                                            <textarea name="description" class="form-control <?php echo e($errors->has('description') ? 'is-invalid' : ''); ?>" id="notification"
                                                value="<?php echo e(old('description')); ?>" id="description"></textarea>
                                            <?php if($errors->has('description')): ?>
                                                <div class="invalid-feedback">
                                                    <?php echo e($errors->first('description')); ?>

                                                </div>
                                            <?php endif; ?>
                                        </div>
                                        
                                    </div>
                                </div>

                                <hr>
                                <button class="btn btn-success btn-uppercase waves-effect waves-button waves-light"
                                    type="submit">
                                    <i class="ti-check-box m-r-5"></i><?php echo e(__('message.save')); ?>

                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </main>
    <!-- end::main content -->
<?php $__env->stopSection(); ?>
<?php $__env->startPush('footer-script'); ?>
    <script src="<?php echo e(asset('public/admin/vendors/input-mask/jquery.mask.js')); ?>"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment.min.js"></script>
    <script>
        // Get Section
        $("#class").on('change', function() {
            var URL = "<?php echo e(asset('admission/get-section/')); ?>" + "/" + $(this).val();
            $.ajax({
                type: "GET",
                url: URL,
                dataType: "JSON",
                success: function(data) {
                    $("#section").empty();
                    $("#section").select2({
                        data: data
                    });
                    $("#section").val("<?php echo e(Request::get('section')); ?>").trigger('change');
                }
            });
        });

        $('#type').on('change',function(){
            var type = $(this).val();
            if(type == 'for_all')
            {
                $('.class').css('display','none')
                $('.section').css('display','none')
            }else if(type == 'for_class')
            {
                $('.class').css('display','block')
                $('.section').css('display','none')
            }else if(type == 'for_section')
            {
                $('.class').css('display','block')
                $('.section').css('display','block')
            }
            // alert(type);
        });

        $(".department_change").on('change',function(){
                    var id = $(this).val(); 
                   
                    $.ajaxSetup({
                                headers: {
                                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                                }
                            });

                    $.ajax({
                        type: "post",
                        url: "<?php echo e(asset('hrms/fetch-department-employee')); ?>",
                        data:{
                            id:id
                        },
                        dataType: "html",
                        success: function(result) 
                        {
                            $(".employee_select").html('');
                            var allData = JSON.parse(result);
                            var emp = allData.data;
                            var i;
                            $(".employee_select").append("<option selected disabled>SELECT</option>");
                            for(i=0;i<emp.length;i++)
                            {
                                var option = `                                        
                                        <option value="${emp[i].user_unique_id}">${emp[i].name}</option>
                                        `;
                                $(".employee_select").append(option);
                            }                            
                                                       
                        },
                        error:function(xhr,status,error)
                        {
                            $(".employee_select").html('');
                            console.log(xhr);
                           
                        }
                    });

            });
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\blurb_erp\resources\views/notification/add.blade.php ENDPATH**/ ?>