include ./filelabel.pug mixin fileform(name, max, total, addPath, deletePath, checkName, fileList, nameList, filePath, imageClass, showName) - const capitalName = `${name.charAt(0).toUpperCase()}${name.substring(1)}`; h4.no-m-p Add #{capitalName}s (Max #{total}) .form-wrapper.flexleft.mt-10 form.form-post(action=addPath, enctype='multipart/form-data', method='POST') input(type='hidden' name='_csrf' value=csrf) .row .label span #{capitalName}#{max > 1 ? 's' : ''} span.required * if max > 1 | | small (Max #{max}) span.col +filelabel(name, max) input(id=name type='file', name='file' multiple required) .upload-list(data-spoilers='false' data-strip-filenames='false') input(type='submit', value='submit') if fileList.length > 0 hr(size=1) h4.no-m-p Delete #{capitalName}s: .form-wrapper.flexleft.mt-10 form.form-post(action=deletePath, enctype='application/x-www-form-urlencoded', method='POST') input(type='hidden' name='_csrf' value=csrf) .catalog each file, index in fileList label.banner-check input(type='checkbox' name=checkName value=nameList[index]) img(class=imageClass src=`${filePath}/${file}` loading='lazy') if showName small #{file.substring(0, file.lastIndexOf('.'))} input(type='submit', value='delete')