Browse Source

#save customer DocumentBusiness

feature/19315_Customer-Registration
Leeza Baidar 11 months ago
parent
commit
caae1cae86
  1. 128
      CustomerOnlineV2/CustomerOnlineV2/Views/Customer/CustomerProfile.cshtml

128
CustomerOnlineV2/CustomerOnlineV2/Views/Customer/CustomerProfile.cshtml

@ -318,10 +318,9 @@
<div class="col-12 col-md-6 col-lg-4">
<div class="account-doc rounded p-3">
<div class="front">
@* <img src="images/profile-thumb.jpg" class="img-fluid"> *@
<span class="mt-4">Front</span>
</div>
<div class="account-doc-overlay rounded">
<div id="loadIdFront" class="account-doc-overlay rounded">
<a href="#" data-bs-target="#edit-doc-details" data-bs-toggle="modal" class="text-light btn-link mx-2">
<span class="me-1"><i class="fas fa-edit"></i></span>View
</a>
@ -331,23 +330,15 @@
<div class="col-12 col-md-6 col-lg-4">
<div class="account-doc rounded p-3">
<div class="front">
@* <img src="images/profile-thumb.jpg" class="img-fluid"> *@
<span class="mt-4">Back</span>
</div>
<div class="account-doc-overlay rounded">
<div id="loadIdBack" class="account-doc-overlay rounded">
<a href="#" data-bs-target="#edit-doc-details" data-bs-toggle="modal" class="text-light btn-link mx-2">
<span class="me-1"><i class="fas fa-edit"></i></span>Edit
</a>
</div>
</div>
</div>
@* <div class="col-12 col-md-6 col-lg-4">
<a href="" data-bs-target="#edit-doc-details" data-bs-toggle="modal" class="account-doc-new d-flex align-items-center rounded h-100 p-3 mb-4 mb-lg-0">
<p class="w-100 text-center lh-base m-0">
<span class="text-3"><i class="fas fa-plus-circle"></i></span> <span class="d-block text-body text-3">Add New Document</span>
</p>
</a>
</div> *@
</div>
</div>
<div class="bg-white shadow-sm rounded p-4 mb-4">
@ -359,26 +350,20 @@
</p>
</a>
<hr class="mb-4 mx-n4" />
<div class="row g-3">
<div class="col-12 col-md-6 col-lg-4">
<div class="account-doc rounded p-3">
<div class="front">
@* <img src="images/profile-thumb.jpg" class="img-fluid"> *@
<span class="mt-4">Front</span>
</div>
<div class="account-doc-overlay rounded">
<div id="loadAddId" class="account-doc-overlay rounded">
<a href="#" data-bs-target="#edit-doc-details1" data-bs-toggle="modal" class="text-light btn-link mx-2">
<span class="me-1"><i class="fas fa-edit"></i></span>View
</a>
</div>
</div>
</div>
</div>
</div>
<div id="edit-doc-details" class="modal fade" role="dialog" aria-hidden="true">
@ -393,56 +378,34 @@
<div class="mb-3">
<label for="IdFront" class="form-label">Document Type</label>
<select class="form-select" id="primary-IdType" aria-label="Floating label select example" asp-items="@CustomerOnlineV2.Helper.HelperClass.GetDropdownData("getIdType", true)" required>
@* <select class="form-select" id="doc" name=""> *@
@* <option value="0" selected>-- Select --</option>
<option value="1">Id Card</option>
<option value="2">Passport </option>
<option value="3">License</option> *@
</select>
</div>
<div class="mb-3">
<label for="IdFront" class="form-label">Document Front</label>
<div class="input-group flex-nowrap">
<div class="flex-grow-1">
<input type="file" id="IdFrontUpload" class="form-control" placeholder="Chose File..." />
@* <img id="myUploadedImg" alt="Photo" style="width:180px;" /> *@
</div>
@* <span class="input-group-text px-2">
<button class="btn-choose bg-transparent text-white border-0" id="BtnUpload" type="submit">
< span class="RegisterText"></span>&nbsp;<div class="spinner-border text-success loading" role="status" style="display:none;"></div>
</button>
</span> *@
</div>
</div>
<div class="mb-3">
<label for="IdBack" class="form-label">Document Back</label>
<div class="input-group flex-nowrap">
<div class="flex-grow-1">
<input type="file" id="IdBackUpload" class="form-control" placeholder="Chose File...">
</div>
@* <span class="input-group-text px-2">
<button class="btn-choose bg-transparent text-white border-0" type="button">Upload</button>
</span> *@
</div>
</div>
<div class="d-grid mt-4">
<button type="button" class="btn btn-lg btn-primary" data-bs-dismiss="modal">Done</button>
@* <button class="btn btn-primary" onclick="btnUpload" type="submit">Update Document </button> *@
@* <button type="submit" onclick="FileUpload()" class="btn btn-lg btn-primary" style="width: 250px;">
<span class="ButtonTExt">Update Document</span>&nbsp;<div class="spinner-border text-success loading" role="status" style="display:none;"></div>
</button> *@
<button id="btnUpload" type="button" class="btn btn-lg btn-primary" data-bs-dismiss="modal">Upload</button>
</div>
</form>
</div>
</div>
</div>
</div>
<div id="edit-doc-details1" class="modal fade" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
@ -461,22 +424,12 @@
<label for="IdFront" class="form-label">Document</label>
<div class="input-group flex-nowrap">
<div class="flex-grow-1 ">
<input type="file" id="add_idUpload" class="form-control" placeholder="Chose File..." />
@* <img id="myUploadedImg" alt="Photo" style="width:180px;" /> *@
</div>
</div>
</div>
<div class="d-grid mt-4">
<button type="button" class="btn btn-lg btn-primary" data-bs-dismiss="modal">Done</button>
@* <button class="btn btn-primary" onclick="btnUpload" type="submit">Update Document </button> *@
@* onclick="FileUpload('', '11396', 'Additional_ID_Front', 'add_idUpload')"; *@
@* <button type="button" class="btn btn-lg btn-primary" style="width: 250px;">
<span class="ButtonTExt">Update Document</span>&nbsp;<div class="spinner-border text-success loading" role="status" style="display:none;"></div>
</button> *@
<button id="btnAddIdUpload" type="button" class="btn btn-lg btn-primary" data-bs-dismiss="modal">Upload</button>
</div>
</form>
</div>
@ -511,7 +464,6 @@
processData: false,
contentType: false,
success: function (response) {
if (response.responseCode != 0) {
ShowAlertMessageErrorOnly(response.responseCode, response.responseMessage);
@ -519,9 +471,6 @@
}
$('#profile_img_1').attr('src', response.extra2);
// alert("Files Uploaded! " + response.extra);
}
});
});
@ -589,15 +538,16 @@
});
function getData() {
debugger
$.ajax({
//var id;
type: 'GET',
contentType: 'application/json; charset=utf-8',
url: '/Customer/GetCustomerDetail',
success: function (response) {
var data = response.customerListModel[0];
debugger
var data = response.customerListModel;
var documentData = response.customerDocumentListModel;
$('#fullName').text(data.fullName);
$('#dob').text(data.dob);
@ -615,6 +565,10 @@
$('#idissueDate').text(data.idIssueDate);
$('#expairydate').text(data.idExpiryDate);
$('#expairydate').text(data.idExpiryDate);
// if (documentData && documentData.length > 0){
// }
},
error: function (error) {
console.error(error);
@ -649,11 +603,10 @@
ShowAlertMessageErrorOnly(1, "Error ocurred during update!");
}
});
}
function UpdateDocument() {
$.ajax({
url: "/Customer/UpdateDocument",
type: "post",
@ -666,10 +619,6 @@
nativeCountry: $("#nativeCountry").val(),
idIssueDate: $("#idIssueDate").val(),
idExpiryDate: $("#idExpiryDate").val(),
},
success: function (response) {
if (response.responseCode != 0) {
@ -682,14 +631,12 @@
error: function (data) {
ShowAlertMessageErrorOnly(1, "Error ocurred during update!");
}
}
);
}
function img_pathUrl(id, e) {
// $('#' + id)[0].src = (window.URL ? URL : webkitURL).createObjectURL(input.files[0]);
// $('#' + id)[0].src = (window.URL ? URL : webkitURL).createObjectURL(input.files[0]);
$('.loadImg').remove();
for (var i = 0; i < e.target.files.length; i++) {
@ -707,14 +654,14 @@
$("#IdBackUpload").hide();
});
$("#IdFrontUpload").on('change', function (e) {
let idtype = $('#primary-IdType').val();
for (var i = 0; i < e.target.files.length; i++) {
var tmppath = URL.createObjectURL(e.target.files[i]);
$(this).after('<span class="loadImg"><img height=120 width=200 src="' + tmppath + '" alt=""></span>');
$(".loadImg img").fadeIn("fast");
}
FileUpload(idtype, '11394', 'ID_Front', 'IdFrontUpload');
//FileUpload(idtype, '11394', 'ID_Front', 'IdFrontUpload');
});
$("#IdBackUpload").on('change', function (e) {
@ -725,7 +672,7 @@
$(this).after('<span class="loadImg1"><img height=120 width=200 src="' + tmppath + '" alt=""></span>');
$(".loadImg1 img").fadeIn("fast");
}
FileUpload(idtype, '11395', 'ID_Back', 'IdBackUpload');
//FileUpload(idtype, '11395', 'ID_Back', 'IdBackUpload');
});
$("#add_idUpload").on('change', function (e) {
@ -736,11 +683,24 @@
$(this).after('<span class="loadImg3"><img height=120 width=200 src="' + tmppath + '" alt=""></span>');
$(".loadImg1 img").fadeIn("fast");
}
FileUpload(idtype, '11396', 'Additional_ID_Front', 'add_idUpload');
//FileUpload(idtype, '11396', 'Additional_ID_Front', 'add_idUpload');
});
$("#btnUpload").on('click', function () {
let idtype = $('#primary-IdType').val();
FileUpload(idtype, '11394', 'ID_Front', 'IdFrontUpload');
FileUpload(idtype, '11395', 'ID_Back', 'IdBackUpload');
});
function FileUpload(idtype, documentType,desc, id) {
$("#btnAddIdUpload").on('click', function () {
let idtype = $('#primary-IdType').val();
FileUpload(idtype, '11396', 'Additional_ID_Front', 'add_idUpload');
});
function FileUpload(idtype, documentType, desc, id) {
debugger
const formData = new FormData();
let file = $('#' + id).prop("files")[0];
formData.append('MyUploader', file);
@ -750,7 +710,6 @@
formData.append('description', desc);
$.ajax(
{
type: 'POST',
url: '/CustomerDocument/AddDocument',
data: formData,
@ -763,24 +722,31 @@
$('input:hidden[name="__RequestVerificationToken"]').val());
},
success: function (response) {
debugger
if (response.responseCode != 0) {
ShowAlertMessageErrorOnly(data, response.responseMessage);
return false;
}
$('.loadImg').remove();
$('.loadImg1').remove();
$('.loadImg3').remove();
$('#primary-IdType').val('');
$('#Add-IdType').val('');
$('#IdFrontUpload').val('');
$('#IdBackUpload').val('');
$('#add_idUpload').val('');
ShowAlertMessage("0", "Document Add successfully.");
$('#edit-doc-details').modal('hide');
$('#edit-doc-details1').modal('hide');
ShowAlertMessage("0", "Document uploaded successfully.");
window.location.reload();
},
error: function (data) {
alert("Error occurs");
}
});
}
</script>
Loading…
Cancel
Save