fix: Refactor Upload Attendance (#17241)

New API frappe.ui.FileUploader
https://github.com/frappe/frappe/pull/7253
diff --git a/erpnext/hr/doctype/upload_attendance/upload_attendance.js b/erpnext/hr/doctype/upload_attendance/upload_attendance.js
index 776fd3c..277c060 100644
--- a/erpnext/hr/doctype/upload_attendance/upload_attendance.js
+++ b/erpnext/hr/doctype/upload_attendance/upload_attendance.js
@@ -29,19 +29,12 @@
 			});
 	},
 
-	show_upload: function() {
-		var me = this;
+	show_upload() {
 		var $wrapper = $(cur_frm.fields_dict.upload_html.wrapper).empty();
-
-		// upload
-		frappe.upload.make({
-			parent: $wrapper,
-			args: {
-				method: 'erpnext.hr.doctype.upload_attendance.upload_attendance.upload'
-			},
-			no_socketio: true,
-			sample_url: "e.g. http://example.com/somefile.csv",
-			callback: function(attachment, r) {
+		new frappe.ui.FileUploader({
+			wrapper: $wrapper,
+			method: 'erpnext.hr.doctype.upload_attendance.upload_attendance.upload',
+			on_success(file_doc, r) {
 				var $log_wrapper = $(cur_frm.fields_dict.import_log.wrapper).empty();
 
 				if(!r.messages) r.messages = [];
@@ -59,10 +52,10 @@
 					});
 
 					r.messages = ["<h4 style='color:red'>"+__("Import Failed!")+"</h4>"]
-						.concat(r.messages)
+						.concat(r.messages);
 				} else {
-					r.messages = ["<h4 style='color:green'>"+__("Import Successful!")+"</h4>"].
-						concat(r.message.messages)
+					r.messages = ["<h4 style='color:green'>"+__("Import Successful!")+"</h4>"]
+						.concat(r.message.messages);
 				}
 
 				$.each(r.messages, function(i, v) {
@@ -79,11 +72,7 @@
 				});
 			}
 		});
-
-		// rename button
-		$wrapper.find('form input[type="submit"]')
-			.attr('value', 'Upload and Import')
-	}
+	},
 })
 
 cur_frm.cscript = new erpnext.hr.AttendanceControlPanel({frm: cur_frm});
diff --git a/erpnext/hr/doctype/upload_attendance/upload_attendance.py b/erpnext/hr/doctype/upload_attendance/upload_attendance.py
index db74b10..6a4ea6a 100644
--- a/erpnext/hr/doctype/upload_attendance/upload_attendance.py
+++ b/erpnext/hr/doctype/upload_attendance/upload_attendance.py
@@ -116,10 +116,10 @@
 	if not frappe.has_permission("Attendance", "create"):
 		raise frappe.PermissionError
 
-	from frappe.utils.csvutils import read_csv_content_from_uploaded_file
+	from frappe.utils.csvutils import read_csv_content
 	from frappe.modules import scrub
 
-	rows = read_csv_content_from_uploaded_file()
+	rows = read_csv_content(frappe.local.uploaded_file)
 	rows = list(filter(lambda x: x and any(x), rows))
 	if not rows:
 		msg = [_("Please select a csv file")]