
<form action="<?php echo e(route('source_data.store')); ?>" method="post" class="mt-2" id="addSourceDataForm" novalidate="novalidate"  enctype="multipart/form-data">
    <?php echo e(csrf_field()); ?>

    <div class="row align-items-center justify-content-center">
        <div class="col-md-12">
            <div class="form-group">
                <label>Stationary File (UP)</label>
                <input type="file" name="stationary_file_up" class="w-100 p-1 border-primary" title="Select Stationary File (UP)" data-rule-required="true" data-msg-required="Stationary File (UP) is required" data-rule-extension="txt" data-msg-extension="Only file with extension txt allowed" data-rule-accept="text/plain" data-msg-accept="Only Text file allowed" data-rule-maxsize="15728640" data-msg-maxsize="File Size must not exceed 15 MB (15360 KB).">
            </div>
        </div>

        <div class="col-md-12">
            <div class="form-group">
                <label>Stationary File (PayPak)</label>
                <input type="file" name="stationary_file_paypak" class="w-100 p-1 border-primary" title="Select Stationary File (PayPak)" data-rule-required="true" data-msg-required="Stationary File (PayPak) is required" data-rule-extension="txt" data-msg-extension="Only file with extension txt allowed" data-rule-accept="text/plain" data-msg-accept="Only Text file allowed" data-rule-maxsize="15728640" data-msg-maxsize="File Size must not exceed 15 MB (15360 KB).">
            </div>
        </div>

        <div class="w-100"></div>

        <div class="col-md-12">
            <div class="form-group">
                <label>Card File (UP)</label>
                <input type="file" name="card_file_up" class="w-100 p-1 border-primary" title="Select Card File (UP)" data-rule-required="true" data-msg-required="Card File (UP) is required" data-rule-extension="txt" data-msg-extension="Only file with extension txt allowed" data-rule-accept="text/plain" data-msg-accept="Only Text file allowed" data-rule-maxsize="15728640" data-msg-maxsize="File Size must not exceed 15 MB (15360 KB).">
            </div>
        </div>

        <div class="col-md-12">
            <div class="form-group">
                <label>Card File (PayPak)</label>
                <input type="file" name="card_file_paypak" class="w-100 p-1 border-primary" title="Select Card File (PayPak)" data-rule-required="true" data-msg-required="Card File (PayPak) is required" data-rule-extension="txt" data-msg-extension="Only file with extension txt allowed" data-rule-accept="text/plain" data-msg-accept="Only Text file allowed" data-rule-maxsize="15728640" data-msg-maxsize="File Size must not exceed 15 MB (15360 KB).">
            </div>
        </div>

        <div class="w-100"></div>


        <div class="col-auto">
            <div class="form-group text-right my-1">
                <button type="submit" name="upload" class="btn btn-dark">Upload</button>
            </div>
        </div>
    </div>
</form>

	<script type="text/javascript">
		$(document).ready(function() {
			$.validator.addMethod('maxsize', function(value, element, params) {
				if ($(element).attr('type') === 'file') {
					if (element.files && element.files.length) {
						console.log(element.files);
						for (var c = 0; c < element.files.length; c++) {
							if (element.files[c].size > params) {
								return false;
							}
						}
					}
				}

				return true;
			}, $.validator.format("File Size must not exceed {0} bytes."));

			$('#addSourceDataForm').validate({
				errorClass: 'danger',
				successClass: 'success',
				normalizer: function(value) {
					return $.trim(value);
				},
				errorPlacement: function(error, element) {
					error.addClass('w-100').appendTo(element.parent('.form-group'));
				},
				submitHandler: function(form) {
					$(form).find('button[type=submit]').attr('disabled', 'disabled');

					swal({
						title: 'Please Wait!',
						text: 'Your data will be converted shortly!',
						icon: 'info',
						buttons: false,
						closeOnClickOutside: false,
						closeOnEsc: false
					});

					form.submit();
				}
			});
            
      
		});
	</script>
<?php /**PATH C:\laragon\www\catalyst\resources\views/source_data/add_source_data_form.blade.php ENDPATH**/ ?>