<?php $__env->startSection('title','File Document'); ?>
<?php $__env->startSection('crumbs','<a href="'.route('docs-library.index').'">Document Library</a> · <b>File document</b>'); ?>
<?php $__env->startSection('content'); ?>
<div class="card" style="max-width:640px"><div class="card-h"><h2>＋ File document</h2></div>
<div class="card-b">
<form method="POST" action="<?php echo e(route('docs-library.store')); ?>" enctype="multipart/form-data">
<?php echo csrf_field(); ?>
<?php if($errors->any()): ?><div class="flash err">✕ <?php echo e($errors->first()); ?></div><?php endif; ?>
<div class="frow">
<div class="fld c6"><label>File (max 20 MB — pdf, office, images, csv, zip)</label><input type="file" name="file" required></div>
<div class="fld c6"><label>Display name <small class="muted">(blank = original filename; re-using a name on the same record saves a new version)</small></label><input type="text" name="file_name" value="<?php echo e(old('file_name')); ?>" placeholder="e.g. EPA permit 2026.pdf"></div>
<div class="fld c6"><label>Link to</label><select name="attachable_type" id="ownerType">
<option value="unfiled">— Unfiled (general library) —</option>
<?php $__currentLoopData = $owners; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $class => $o): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($class); ?>" <?php echo e(old('attachable_type')===$class?'selected':''); ?>><?php echo e($o[0]); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select></div>
<div class="fld c6" id="ownerIdWrap"><label>Record ID <small class="muted">(e.g. customer # or invoice #)</small></label><input type="number" min="1" name="attachable_id" value="<?php echo e(old('attachable_id')); ?>"></div>
</div>
<div style="margin-top:12px;display:flex;gap:8px">
<button class="btn">Upload & file</button>
<a class="btn btn-ghost" href="<?php echo e(route('docs-library.index')); ?>">Cancel</a>
</div>
</form>
</div></div>
<script>
(function(){var t=document.getElementById('ownerType'),w=document.getElementById('ownerIdWrap');
function sync(){w.style.display=t.value==='unfiled'?'none':'';}t.addEventListener('change',sync);sync();})();
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/user/nowills-sqc-erp/resources/views/docs-library/create.blade.php ENDPATH**/ ?>