<?php $__env->startSection('mainContent'); ?>
    <section class="admin-visitor-area up_st_admin_visitor">
        <div class="container-fluid p-0">
            <div class="row justify-content-center">
                <div class="col-12">
                    <div class="">
                        <div class="row">
                            <div class="col-lg-12 mt-4">
                                <div class="white_box_30px">
                                    <!-- SMTP form  -->
                                    <div class="main-title mb-25">
                                        <h3 class="mb-3"><?php echo e(__('whatsapp.update_agent')); ?></h3>
                                    </div>
                                    <form action="<?php echo e(route('whatsapp-support.agents.update')); ?>" method=POST
                                          enctype=multipart/form-data>
                                        <?php echo csrf_field(); ?>
                                        <div class="row" id="pusher">
                                            <div class="col-xl-12 mb-4">
                                                <label class="primary_input_label mb-3"><?php echo e(__('common.Type')); ?>

                                                    <span class="required_mark">*</span></label>
                                                <div class="d-flex radio-btn-flex">
                                                    <div class="me-3">
                                                        <input type="radio"   name="type" required
                                                               id="relationType1" value="1"
                                                               <?php echo e($agent->type==1?'checked':''); ?>

                                                               class="common-radio relationButton typeInput">
                                                        <label
                                                            for="relationType1"><?php echo e(__('whatsapp.Whatsapp')); ?></label>
                                                    </div>
                                                    <div class="me-3">
                                                        <input type="radio" name="type" id="relationType2" value="2"
                                                               <?php echo e($agent->type==2?'checked':''); ?>

                                                               class="common-radio relationButton typeInput">
                                                        <label
                                                            for="relationType2"><?php echo e(__('whatsapp.Website URL')); ?></label>
                                                    </div>

                                                </div>
                                            </div>
                                            <div class="col-xl-6 mt-4">
                                                <div class="primary_input mb-25">
                                                    <label class="primary_input_label"
                                                           for=""><?php echo e(__('whatsapp.name')); ?> *</label>
                                                    <input class="primary_input_field" name="name" type="text"
                                                           value="<?php echo e($agent->name); ?>">
                                                </div>
                                            </div>

                                            <div class="col-xl-6 mt-4">
                                                <div class="primary_input mb-25">
                                                    <label class="primary_input_label"
                                                           for=""><?php echo e(__('whatsapp.designation')); ?>

                                                        *</label>
                                                    <input class="primary_input_field" name="designation" type="text"
                                                           value="<?php echo e($agent->designation); ?>">
                                                </div>
                                            </div>


                                            <div class="col-xl-6 mb-4 <?php echo e($agent->type==2?'':'d-none'); ?>" id="typeURL">
                                                <div class="primary_input ">
                                                    <label class="primary_input_label"
                                                           for=""><?php echo e(__('whatsapp.URL')); ?>

                                                        <span class="required_mark">*</span></label>
                                                    <input class="primary_input_field" name="url" type="text"
                                                           value="<?php echo e($agent->url); ?>"
                                                    >
                                                </div>
                                            </div>

                                            <div class="col-xl-6 mt-4 <?php echo e($agent->type==1?'':'d-none'); ?>" id="typeWhatsapp">
                                                <div class="primary_input mb-25">
                                                    <label class="primary_input_label"
                                                           for=""><?php echo e(__('whatsapp.number')); ?> * (<small
                                                            class="text-danger"><?php echo e(__('whatsapp.with_country_code')); ?></small>)</label>
                                                    <input class="primary_input_field" name="number" type="text"
                                                           value="<?php echo e($agent->number); ?>">
                                                </div>
                                            </div>

                                            <div class="col-xl-6 mt-4">
                                                <div class="  mb-25">
                                                    <?php if (isset($component)) { $__componentOriginal3c189c37dfafa3e6853f94906c245d36 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal3c189c37dfafa3e6853f94906c245d36 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.upload-file','data' => ['name' => 'avatar','type' => 'image','mediaId' => ''.e(isset($agent)?$agent->avater_media?->media_id:'').'','label' => ''.e(__('whatsapp.avatar')).'']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('upload-file'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'avatar','type' => 'image','media_id' => ''.e(isset($agent)?$agent->avater_media?->media_id:'').'','label' => ''.e(__('whatsapp.avatar')).'']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal3c189c37dfafa3e6853f94906c245d36)): ?>
<?php $attributes = $__attributesOriginal3c189c37dfafa3e6853f94906c245d36; ?>
<?php unset($__attributesOriginal3c189c37dfafa3e6853f94906c245d36); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal3c189c37dfafa3e6853f94906c245d36)): ?>
<?php $component = $__componentOriginal3c189c37dfafa3e6853f94906c245d36; ?>
<?php unset($__componentOriginal3c189c37dfafa3e6853f94906c245d36); ?>
<?php endif; ?>

                                                </div>
                                            </div>

                                            <div class="col-xl-6 mt-4">
                                                <p class="primary_input_label"><?php echo e(__('whatsapp.status')); ?>

                                                    *</p>
                                                <div class="d-flex radio-btn-flex">
                                                    <div class="me-3">
                                                        <input type="radio" name="status"
                                                               <?php echo e($agent->status ? 'checked' : ''); ?> required
                                                               id="relationFather3" value="1"
                                                               class="common-radio relationButton">
                                                        <label
                                                            for="relationFather3"><?php echo e(__('whatsapp.active')); ?></label>
                                                    </div>
                                                    <div class="me-3">
                                                        <input type="radio" name="status"
                                                               <?php echo e(!$agent->status ? 'checked' : ''); ?> id="relationMother4"
                                                               value="0" class="common-radio relationButton">
                                                        <label
                                                            for="relationMother4"><?php echo e(__('whatsapp.inactive')); ?></label>
                                                    </div>
                                                    <?php $__errorArgs = ['status'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <small
                                                        class="text-danger font-italic">*<?php echo e($message); ?></small> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                                </div>
                                            </div>

                                            <div class="col-xl-6 mt-4">
                                                <p class="primary_input_label"><?php echo e(__('whatsapp.always_available')); ?>

                                                    *</p>
                                                <div class="d-flex radio-btn-flex">
                                                    <div class="me-3">
                                                        <input type="radio" name="always_available"
                                                               <?php echo e($agent->always_available ? 'checked' : ''); ?> required
                                                               id="relationFather33333" value="1"
                                                               class="common-radio relationButton" checked>
                                                        <label
                                                            for="relationFather33333"><?php echo e(__('whatsapp.yes')); ?></label>
                                                    </div>
                                                    <div class="me-3">
                                                        <input type="radio" name="always_available"
                                                               <?php echo e(!$agent->always_available ? 'checked' : ''); ?> id="relationMother4433"
                                                               value="0" class="common-radio relationButton">
                                                        <label
                                                            for="relationMother4433"><?php echo e(__('whatsapp.no')); ?></label>
                                                    </div>
                                                    <?php $__errorArgs = ['always_available'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <small
                                                        class="text-danger font-italic">*<?php echo e($message); ?></small> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                                </div>
                                                <input type="hidden" name="agent_id" value="<?php echo e($agent->id); ?>">
                                            </div>

                                            <div class="col-xl-6 mt-4">
                                                <h4>Time : </h4>
                                                <?php $__currentLoopData = \Carbon\Carbon::getDays(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $day): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <div class="row g-0  input-right-icon mt-25 align-items-center row-gap-24">
                                                        <div class="col-md-3">
                                                            <div class="input-effect">
                                                                <input
                                                                    <?php echo e($agent->times->contains('day', $day) ? 'checked' : ''); ?> type="checkbox"
                                                                    id="isBreak<?php echo e($index); ?>"
                                                                    class="common-checkbox read-only-input"
                                                                    value="<?php echo e($day); ?>" name="day[]">
                                                                <label for="isBreak<?php echo e($index); ?>"><?php echo e($day); ?></label>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-3">
                                                            <div class="col">
                                                                <div class="input-effect">
                                                                    <input
                                                                        value="<?php echo e($agent->times->where('day', $day)->first()->start ?? ''); ?>"
                                                                        id="agent_start<?php echo e($index); ?>"
                                                                        class="primary-input time form-control has-content"
                                                                        type="text" name="start[]">
                                                                    <label class="primary_input_label mt-1">Start Time</label>
                                                                    <span class="focus-border"></span>
                                                                </div>
                                                            </div>
                                                            <div class="col-auto">
                                                                <button class="" type="button">

                                                                </button>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-3">
                                                            <div class="col">
                                                                <div class="input-effect">
                                                                    <input id="agent_end<?php echo e($index); ?>"
                                                                           value="<?php echo e($agent->times->where('day', $day)->first()->end ?? ''); ?>"
                                                                           class="primary-input time form-control has-content"
                                                                           type="text" name="end[]">
                                                                    <label class="primary_input_label mt-1">End Time</label>
                                                                    <span class="focus-border"></span>
                                                                </div>
                                                            </div>
                                                            <div class="col-auto">
                                                                <button class="" type="button">

                                                                </button>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-3">
                                                            <?php if($index == 0): ?>
                                                                <p onclick="setTimeToAll()"
                                                                   class="primary-btn radius_30px w-fit fix-gr-bg ms-3">Apply
                                                                    All Days</p>
                                                            <?php endif; ?>
                                                        </div>
                                                    </div>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </div>
                                        </div>
                                        <div class="d-flex align-content-center justify-content-center">
                                            <button class="primary-btn   fix-gr-bg mt-4" type="submit"><i
                                                    class="ti-check"></i><?php echo e(__('whatsapp.update')); ?>

                                            </button>
                                        </div>

                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
<?php $__env->stopSection(); ?>
<?php $__env->startPush('scripts'); ?>
    <script type="application/javascript">

        
        $(document).ready(function () {
            $(document).on('click', '.typeInput', function () {
                let whatsappType=$('#typeWhatsapp');
                let urlType=$('#typeURL');

                if ($(this).val() == 1) {
                    whatsappType.removeClass('d-none');
                    urlType.addClass('d-none');
                }else{

                    whatsappType.addClass('d-none');
                    urlType.removeClass('d-none');
                }
            })
        })
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('backend.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/minialms/app.minialms.com/Modules/WhatsappSupport/Resources/views/agents/show.blade.php ENDPATH**/ ?>