![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/medad.corals.io/storage/framework/views/ |
<div class="row"> <?php if((isset($showAttachmentsForm) && $showAttachmentsForm) || !isset($showAttachmentsForm)): ?> <div class="col-md-12"> <h4><?php echo app('translator')->get('Media::labels.media.attachment.add_new_attachments'); ?></h4> <?php if((isset($hasForm) && $hasForm) || !isset($hasForm)): ?> <?php echo Form::model($object, ['url' => $url,'method'=>'POST','class'=>'', 'files' => true,'class'=>'ajax-form']); ?> <?php endif; ?> <table id="values-table" style="width:100%;" class="table table-striped table-responsive key-value-table"> <thead> <tr> <th style="width:50%;"><?php echo app('translator')->get('Media::labels.media.attachment.description'); ?></th> <th style="width:50%;"><?php echo app('translator')->get('Media::labels.media.attachment.attachments'); ?></th> <th></th> <th></th> </tr> </thead> <tbody> </tbody> </table> <button type="button" class="btn btn-success btn-sm" id="add-value"><i class="fa fa-plus"></i> </button> <span class="help-block"><?php echo app('translator')->get('Media::labels.media.attachment.click_to_add_new_row'); ?></span> <div class="form-group"> <span data-name="attachments"></span> </div> <?php if((isset($hasForm) && $hasForm) || !isset($hasForm)): ?> <?php echo CoralsForm::formButtons('<i class="fa fa-save"></i> '.trans('Media::labels.media.attachment.add_attachments') ,[],['show_cancel'=>false]); ?> <?php echo Form::close(); ?> <?php endif; ?> </div> <?php endif; ?> <?php if($object->exists): ?> <div class="col-md-12"> <h4><?php echo app('translator')->get('Media::labels.media.attachment.attachments'); ?></h4> <?php echo $__env->make('Media::show_attachments', ['object'=>$object, 'canDelete'=> ((isset($showAttachmentsForm) && $showAttachmentsForm) || !isset($showAttachmentsForm))], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> </div> <?php endif; ?> </div> <?php if((isset($showAttachmentsForm) && $showAttachmentsForm) || !isset($showAttachmentsForm)): ?> <script> var attachmentScripts = function () { let index = $('#values-table tbody tr:last').data('index'); $('#add-value').on('click', function () { let lastRow = $('#values-table tbody '); if (isNaN(index)) { index = 0; } else { index++; } <?php $attachmentDesc = \ListOfValues::get('attachment-description-options', false,'active', true); ?> let arr = <?php echo json_encode($attachmentDesc, 15, 512) ?>; let newInput = $('<select>', { type: 'select', name: 'attachments[' + index + '][description]', class: 'form-control form-white field', }); $.each(arr, function (key, value) { newInput .append($("<option></option>") .attr("value", key) .text(value)); }); let newFileInput = $('<input>', { type: 'file', id: 'attachments', name: 'attachments[' + index + '][file]', class: 'form-control form-white field', }); let newRemoveButton = $('<button/>', { class: "btn btn-danger btn-sm remove-value", style: "margin:0;", type: "button" }); newRemoveButton.append('<i class="fa fa-remove"></i>'); inputDiv = $('<div/>', { class: 'form-group' }); let downTd = $('<td/>'); let selectTd = $('<td/>').append(inputDiv); let fileTd = selectTd.clone(); let removeButtonTd = selectTd.clone(); fileTd.find('div').append(newFileInput); selectTd.find('div').append(newInput); removeButtonTd.find('div').append(newRemoveButton); let tr = $('<tr/>').append(selectTd).append(fileTd).append(downTd).append(removeButtonTd); lastRow.append(tr); }); $(document).on('click', '.remove-value', function () { let row = $(this).closest('tr'); let index = $(this).data('action'); if (!index) { row.remove(); return true; } }); }; window.initFunctions.push('attachmentScripts'); </script> <?php endif; ?> <?php /**PATH /home/corals/medad.corals.io/Corals/core/Media/resources/views/attachments_section.blade.php ENDPATH**/ ?>