|
@@ -0,0 +1,207 @@
|
|
1
|
+function wattantyFunction() {
|
|
2
|
+ debugger;
|
|
3
|
+ let order_card = `<div class=warranty_product><div class="py-3 warranty_productform"><div class=mb-3><label class=form-label for=Add_serial_number_inp>Enter Your Serial Number</label><input class=form-control id=Add_serial_number_inp required><label class="form-label text-danger d-none error_serial_num" for=Add_serial_number_inp >Serial Number should not be empty</label></div><div class=mb-3><label class="form-label d-none Add_phonenumber_inp_label" for=Add_phonenumber_inp>Enter Your Phone Number</label> <input class="form-control d-none "id=Add_phonenumber_inp required><label class="text-danger d-none form-label error_phonenumber" for=Add_phonenumber_inp>Enter Valid Phone Number</label></div><div class=mb-3><label class="form-label d-none Add_Contact_inp_label" for=Add_contactname_inp>Enter Your Contactname</label> <input class="form-control d-none" id=Add_contactname_inp required></div><div class="serial_submit text-end"><button class="btn btn-dark warranty_serialNumber_check" type="button">Submit</button><button class="btn btn-dark warranty_serialNumber_submit d-none" type="button">Submit</button></div></div></div>`;
|
|
4
|
+
|
|
5
|
+ $(".user_orders").append(order_card);
|
|
6
|
+ $(".add_serialNum").click(function () {
|
|
7
|
+ $(".warranty_productform").removeClass("d-none");
|
|
8
|
+ $(this).addClass("d-none");
|
|
9
|
+ });
|
|
10
|
+ $(".warranty_serialNumber_submit").click(async function () {
|
|
11
|
+ let serial_no_inp = $("#Add_serial_number_inp").val();
|
|
12
|
+ let phonenumber_inp = $("#Add_phonenumber_inp").val();
|
|
13
|
+ let contactname_inp = $("#Add_contactname_inp").val();
|
|
14
|
+ if (serial_no_inp && phonenumber_inp != "") {
|
|
15
|
+ $(".error_serial_num").addClass("d-none");
|
|
16
|
+ $(".error_phonenumber").addClass("d-none");
|
|
17
|
+ $("#Add_serial_number_inp").removeClass("border-danger");
|
|
18
|
+ $("#Add_phonenumber_inp").removeClass("border-danger");
|
|
19
|
+ let port = "https://anwi.bizgaze.app";
|
|
20
|
+ debugger;
|
|
21
|
+ let url = `${port}/apis/v4/Bizgaze/integrations/products/warrantyservice/serialno/${serial_no_inp}`;
|
|
22
|
+ console.log(url);
|
|
23
|
+ const STAT = `05b2f2ca510344968c65e1ebf49a5595`;
|
|
24
|
+ const config = {
|
|
25
|
+ url,
|
|
26
|
+ method: "get",
|
|
27
|
+ headers: {
|
|
28
|
+ Authorization: `stat ${STAT}`,
|
|
29
|
+ },
|
|
30
|
+ };
|
|
31
|
+ let response = await axios(config);
|
|
32
|
+ debugger;
|
|
33
|
+ console.log(response);
|
|
34
|
+ let product_res = response.data.result;
|
|
35
|
+ if (product_res != null) {
|
|
36
|
+ let warrenty_res = JSON.parse(product_res);
|
|
37
|
+ let new_arr = [warrenty_res];
|
|
38
|
+ $.each(new_arr, function (key, value) {
|
|
39
|
+ console.log(value);
|
|
40
|
+ if (response.data.result == "[]") {
|
|
41
|
+ // Command: toastr["error"]("Serial number not found !")
|
|
42
|
+ // toasterOpts();
|
|
43
|
+ // $('#Add_serial_number_inp').addClass('border-danger');
|
|
44
|
+ // $('.error_serial_num').removeClass('d-none')
|
|
45
|
+ $(".user_Warranty_details").html(
|
|
46
|
+ `<div class="text-danger d-flex align-items-center bg-dangerLite text-dark p-2 rounded-4 mb-3" style="background-color: #ffe2e0!important;display:block"><div class="mr-1 d-flex justify-content-center align-items-center" style="width: 30px; height: 10px;"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.2646 3.41366C11.7212 3.15681 12.2788 3.15681 12.7354 3.41366L19.2354 7.06991C19.7077 7.33558 20 7.83536 20 8.37727V15.6227C20 16.1646 19.7077 16.6644 19.2354 16.9301L12.7354 20.5863C12.2788 20.8432 11.7212 20.8432 11.2646 20.5863L4.76461 16.9301C4.29229 16.6644 4 16.1646 4 15.6227V8.37727C4 7.83536 4.29229 7.33559 4.76461 7.06991L11.2646 3.41366Z" fill="#FF3A2E"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M11 7.4C11 7.17909 11.1791 7 11.4 7H12.6C12.8209 7 13 7.17909 13 7.4V12.6C13 12.8209 12.8209 13 12.6 13H11.4C11.1791 13 11 12.8209 11 12.6V7.4Z" fill="white"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M11 16C11 15.4477 11.4477 15 12 15C12.5523 15 13 15.4477 13 16C13 16.5523 12.5523 17 12 17C11.4477 17 11 16.5523 11 16Z" fill="white"></path></svg></div><div class="d-flex justify-content-center align-items-center font-12">Serial Number Not Found</div></div>`
|
|
47
|
+ );
|
|
48
|
+ setTimeout(function(){
|
|
49
|
+ $('.bg-dangerLite').hide()
|
|
50
|
+ }, 1000)
|
|
51
|
+ // $('.warranty_productform').addClass('d-none');
|
|
52
|
+ // $('.add_serialNum').removeClass('d-none');
|
|
53
|
+ return;
|
|
54
|
+ } else {
|
|
55
|
+ const warrantyEnabled = value[0].warrantyenabled;
|
|
56
|
+ $('.warranty_status_main_container').addClass('d-none')
|
|
57
|
+ if (warrantyEnabled == false) {
|
|
58
|
+ let phonenumber_updated = Number(phonenumber_inp);
|
|
59
|
+ $(".user_Warranty_details").removeClass("d-none");
|
|
60
|
+ // let strDate = new Date(value[0].purchasedate).toISOString().slice(0, 10);
|
|
61
|
+ let Warrentypayload = {
|
|
62
|
+ sku: value[0].sku,
|
|
63
|
+ serialno: serial_no_inp,
|
|
64
|
+ phonenumber: phonenumber_updated,
|
|
65
|
+ contactname: contactname_inp,
|
|
66
|
+ warrantyfromdate: value[0].purchasedate,
|
|
67
|
+ };
|
|
68
|
+ warrentyService(Warrentypayload);
|
|
69
|
+ } else {
|
|
70
|
+ $('.backtoform').removeClass('d-none')
|
|
71
|
+ // let warrantySerialnumber =$('.serial_no_warrantynumber').text()
|
|
72
|
+ let warrenty_date = value[0].warrantytodate;
|
|
73
|
+ // let userwarrenty_product = `<div class="border-3 border-start my-3 order-cards ps-4 rounded-0" id='order-cards'> <div class="col-md-12 "><b>Warranty For :</b> ${value[0].itemname}</div><div class="row align-items-center"> <div class=col-md-12> <div class="col-md-6 my-2"><span>Serail NO :</span> <span class="fs-9 text-secondary serial_no_warrantynumber">${value[0].serialno}</span> </div><div class="col-md-6 my-2"><span> Warrenty Expiry Date :</span> <span class=" fs-9 text-secondary rounded-2 warrenty_date">${value[0].warrantytodate}</span> </div><div class="my-2 col-md-6"><span> Warranty Start Date :</span> <span class="fs-9 text-secondary purchase_date">${value[0].warrantyfromdate}</span> </div><div class="col-md-6 my-2"> <span> Warranty Status : </span><span class="bg-success btn fs-9 is_warranty_enable py-0 text-white"> ${value[0].warrantyenabled}</span> </div></div></div></div>`;
|
|
74
|
+ let userwarrenty_product = `<div class="p-3 bg-white my-3 rounded warranty-card"id=warranty-card><div class="mb-3 card rounded-3 text-white"><div class="row align-items-center g-0 justify-content-between"><div class="col-md-3 text-center"><img alt=guarantee src=../dist/assets/imgs/guarantee.png class="h-50p img-fluid w-50p"></div><div class=col-md-9><div class=card-body><h5 class=card-title>Congratulations,</h5><p class=card-text><small>${value[0].contactname} for registering with <span class=fw-bold>anwi systems </span>.You have successfully availed your warranty.</small></div></div></div></div><div class=col-md-12><h4>Here is your warranty Details</h4></div><div class="p-3 border rounded-3"><div class=row><div class=col-6><img alt=Warranty-product src="../dist/assets/imgs/anwi-logo-1.png" class="w-50"></div><div class=col-6><p class=mb-0><small>Serail No</small><p class="mb-0 fs-9 text-secondary serial_no_warrantynumber"><small>${value[0].serialno}</small><p class=mb-0><small>warranty will be applicable till</small><p class="mb-0 fs-9 text-secondary rounded-2 warrenty_date"><small>${value[0].warrantytodate}</small></div></div><h6>Order details</h6><div class="row mb-3"><div class=col-6><p class=mb-0><small>Sku</small><p class="mb-0 fs-9 text-secondary rounded-2 warranty_sku"><small>${value[0].sku}</small></div><div class=col-6><p class=mb-0><small>Itemname</small><p class="mb-0 fs-9 text-secondary rounded-2 warranty_item_name"><small>${value[0].itemname}</small></div></div><h6>Warranty details</h6><div class=row><div class=col-6><p class=mb-0><small>Warranty Start</small><p class="mb-0 fs-9 text-secondary rounded-2"><small class=purchase_date>${value[0].warrantyfromdate}</small></div><div class=col-6><p class=mb-0><small>Warranty status</small><p class="mb-0 fs-9 text-secondary rounded-2"><small class="text-white bg-success is_warranty_enable p-1 rounded-pill">{value[0].warrantyenabled}</small></div></div></div><div class=guide-lines><p class=mb-0><small>Follow Below steps to request your warranty claim.</small><ol><small class=text-secondary><li class=text-secondary>Go to My account</small><small class=text-secondary><li class=text-secondary>Tap on request claim</small><small class=text-secondary><li class=text-secondary>Enter information and send claim request</small></ol></div></div>`;
|
|
75
|
+ let is_warranty_enable = value[0].warrantyenabled;
|
|
76
|
+ debugger;
|
|
77
|
+ $(".user_Warranty_details").html(userwarrenty_product);
|
|
78
|
+ if (is_warranty_enable == true) {
|
|
79
|
+ $(".is_warranty_enable").text("Activated");
|
|
80
|
+ } else {
|
|
81
|
+ $(".is_warranty_enable").text("Not Activated");
|
|
82
|
+ }
|
|
83
|
+ if (warrenty_date == "") {
|
|
84
|
+ $(".warrenty_date").addClass("d-none");
|
|
85
|
+ } else {
|
|
86
|
+ $(".warrenty_date").removeClass("d-none");
|
|
87
|
+ }
|
|
88
|
+ $("#Add_serial_number_inp").addClass("border-success");
|
|
89
|
+ $(".error_serial_num").addClass("d-none");
|
|
90
|
+ $(".add_serialNum").removeClass("d-none");
|
|
91
|
+ }
|
|
92
|
+ }
|
|
93
|
+ });
|
|
94
|
+ }
|
|
95
|
+ } else {
|
|
96
|
+ if (serial_no_inp == "") {
|
|
97
|
+ $("#Add_serial_number_inp").addClass("border-danger");
|
|
98
|
+ $(".error_serial_num").removeClass("d-none");
|
|
99
|
+ } else if (phonenumber_inp == "") {
|
|
100
|
+ $("#Add_phonenumber_inp").addClass("border-danger");
|
|
101
|
+ $(".error_phonenumber").removeClass("d-none");
|
|
102
|
+ }
|
|
103
|
+ }
|
|
104
|
+ });
|
|
105
|
+ $('.warranty_serialNumber_check').click(async function(){
|
|
106
|
+ let serial_no_inp = $("#Add_serial_number_inp").val();
|
|
107
|
+ if (serial_no_inp != "") {
|
|
108
|
+ $(".error_serial_num").addClass("d-none");
|
|
109
|
+ $("#Add_serial_number_inp").removeClass("border-danger");
|
|
110
|
+ let port = "https://anwi.bizgaze.app";
|
|
111
|
+ debugger;
|
|
112
|
+ let url = `${port}/apis/v4/Bizgaze/integrations/products/warrantyservice/serialno/${serial_no_inp}`;
|
|
113
|
+ console.log(url);
|
|
114
|
+ const STAT = `05b2f2ca510344968c65e1ebf49a5595`;
|
|
115
|
+ const config = {
|
|
116
|
+ url,
|
|
117
|
+ method: "get",
|
|
118
|
+ headers: {
|
|
119
|
+ Authorization: `stat ${STAT}`,
|
|
120
|
+ },
|
|
121
|
+ };
|
|
122
|
+
|
|
123
|
+ let response = await axios(config);
|
|
124
|
+ debugger;
|
|
125
|
+ console.log(response);
|
|
126
|
+ let product_res = response.data.result;
|
|
127
|
+ if (product_res != null) {
|
|
128
|
+ if (response.data.result == "[]") {
|
|
129
|
+ $('.bg-dangerLite').removeClass('d-none')
|
|
130
|
+ $(".user_Warranty_details").html(
|
|
131
|
+ `<div class="text-danger d-flex align-items-center bg-dangerLite text-dark p-2 rounded-4 mb-3" style="background-color: #ffe2e0!important;display:block"><div class="mr-1 d-flex justify-content-center align-items-center" style="width: 30px; height: 10px;"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.2646 3.41366C11.7212 3.15681 12.2788 3.15681 12.7354 3.41366L19.2354 7.06991C19.7077 7.33558 20 7.83536 20 8.37727V15.6227C20 16.1646 19.7077 16.6644 19.2354 16.9301L12.7354 20.5863C12.2788 20.8432 11.7212 20.8432 11.2646 20.5863L4.76461 16.9301C4.29229 16.6644 4 16.1646 4 15.6227V8.37727C4 7.83536 4.29229 7.33559 4.76461 7.06991L11.2646 3.41366Z" fill="#FF3A2E"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M11 7.4C11 7.17909 11.1791 7 11.4 7H12.6C12.8209 7 13 7.17909 13 7.4V12.6C13 12.8209 12.8209 13 12.6 13H11.4C11.1791 13 11 12.8209 11 12.6V7.4Z" fill="white"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M11 16C11 15.4477 11.4477 15 12 15C12.5523 15 13 15.4477 13 16C13 16.5523 12.5523 17 12 17C11.4477 17 11 16.5523 11 16Z" fill="white"></path></svg></div><div class="d-flex justify-content-center align-items-center font-12">Serial Number Not Found</div></div>`
|
|
132
|
+ );
|
|
133
|
+
|
|
134
|
+ // );
|
|
135
|
+ setTimeout(function(){
|
|
136
|
+ $('.bg-dangerLite').hide()
|
|
137
|
+ }, 1000)
|
|
138
|
+ return;
|
|
139
|
+ }
|
|
140
|
+ else{
|
|
141
|
+ $('.bg-dangerLite').addClass('d-none')
|
|
142
|
+ $(".Add_phonenumber_inp_label").removeClass('d-none')
|
|
143
|
+ $("#Add_phonenumber_inp").removeClass('d-none')
|
|
144
|
+ $(".Add_Contact_inp_label").removeClass('d-none')
|
|
145
|
+ $("#Add_contactname_inp").removeClass('d-none')
|
|
146
|
+ $(".warranty_serialNumber_submit").removeClass('d-none')
|
|
147
|
+ $(this).addClass('d-none')
|
|
148
|
+ $(".Serial_numb_notfound").addClass('d-none')
|
|
149
|
+ }
|
|
150
|
+ }
|
|
151
|
+ } else {
|
|
152
|
+ if (serial_no_inp == "") {
|
|
153
|
+ $("#Add_serial_number_inp").addClass("border-danger");
|
|
154
|
+ $(".error_serial_num").removeClass("d-none");
|
|
155
|
+ }
|
|
156
|
+ }
|
|
157
|
+ })
|
|
158
|
+
|
|
159
|
+ async function warrentyService(Warrentypayload) {
|
|
160
|
+ // let d = new Date();
|
|
161
|
+ // // let strDate = d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate();
|
|
162
|
+ // let strDate = new Date().toISOString().slice(0, 10)
|
|
163
|
+ // console.log(strDate)
|
|
164
|
+ debugger;
|
|
165
|
+ const res = await postAPIServiceWarranty(
|
|
166
|
+ `apis/v4/bizgaze/transact/items/savewarrantyasync`,
|
|
167
|
+ Warrentypayload
|
|
168
|
+ );
|
|
169
|
+ debugger;
|
|
170
|
+ console.log(res);
|
|
171
|
+ if (res.data.status == 2) {
|
|
172
|
+ // $('.warranty_productform').addClass('d-none');
|
|
173
|
+ // $('.add_serialNum').removeClass('d-none');
|
|
174
|
+ // Command: toastr["warning"](res.data.message)
|
|
175
|
+ // toasterOpts();
|
|
176
|
+ $('.warranty_status_main_container').removeClass('d-none')
|
|
177
|
+ $('.bg-dangerLite').removeClass('d-none');
|
|
178
|
+ $(".user_Warranty_details").html(
|
|
179
|
+ `<div class="text-danger d-flex align-items-center bg-dangerLite text-dark p-2 rounded-4 mb-3" style="background-color: #ffe2e0!important;display:block"><div class="mr-1 d-flex justify-content-center align-items-center" style="width: 30px; height: 10px;"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.2646 3.41366C11.7212 3.15681 12.2788 3.15681 12.7354 3.41366L19.2354 7.06991C19.7077 7.33558 20 7.83536 20 8.37727V15.6227C20 16.1646 19.7077 16.6644 19.2354 16.9301L12.7354 20.5863C12.2788 20.8432 11.7212 20.8432 11.2646 20.5863L4.76461 16.9301C4.29229 16.6644 4 16.1646 4 15.6227V8.37727C4 7.83536 4.29229 7.33559 4.76461 7.06991L11.2646 3.41366Z" fill="#FF3A2E"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M11 7.4C11 7.17909 11.1791 7 11.4 7H12.6C12.8209 7 13 7.17909 13 7.4V12.6C13 12.8209 12.8209 13 12.6 13H11.4C11.1791 13 11 12.8209 11 12.6V7.4Z" fill="white"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M11 16C11 15.4477 11.4477 15 12 15C12.5523 15 13 15.4477 13 16C13 16.5523 12.5523 17 12 17C11.4477 17 11 16.5523 11 16Z" fill="white"></path></svg></div><div class="d-flex justify-content-center align-items-center font-12">No Serial number found / Product not Delivered</div></div>`
|
|
180
|
+ );
|
|
181
|
+ setTimeout(function(){
|
|
182
|
+ $('.bg-dangerLite').hide()
|
|
183
|
+ }, 1000)
|
|
184
|
+ } else if (res.data.status == "0") {
|
|
185
|
+ $(".user_Warranty_details").html(`<div class="text-danger d-flex align-items-center bg-dangerLite text-dark p-2 rounded-4 mb-3" style="background-color:#fff!important;display:block"><div class="mr-1 d-flex justify-content-center align-items-center" style="width: 30px; height: 10px;"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48px" height="48px" baseProfile="basic"><circle cx="24" cy="24" r="20" fill="#6be3a2"/><path fill="#324561" d="M22.5,33c-0.226,0-0.446-0.076-0.625-0.219l-7.5-6c-0.431-0.345-0.501-0.974-0.156-1.405 c0.347-0.431,0.975-0.501,1.406-0.156l6.667,5.334l9.889-14.126c0.316-0.454,0.94-0.562,1.393-0.246 c0.453,0.317,0.562,0.94,0.246,1.393l-10.5,15c-0.158,0.227-0.403,0.377-0.677,0.417C22.595,32.997,22.547,33,22.5,33z"/></svg></div><div class="d-flex justify-content-center align-items-center font-12">${res.data.message}</div></div>`);
|
|
186
|
+ }
|
|
187
|
+ }
|
|
188
|
+ // function toasterOpts() {
|
|
189
|
+ // toastr.options = {
|
|
190
|
+ // "closeButton": true,
|
|
191
|
+ // "debug": false,
|
|
192
|
+ // "newestOnTop": true,
|
|
193
|
+ // "progressBar": true,
|
|
194
|
+ // "positionClass": "toast-top-center",
|
|
195
|
+ // "preventDuplicates": true,
|
|
196
|
+ // "showDuration": "300",
|
|
197
|
+ // "hideDuration": "1000",
|
|
198
|
+ // "timeOut": "3000",
|
|
199
|
+ // "extendedTimeOut": "1000",
|
|
200
|
+ // "showEasing": "swing",
|
|
201
|
+ // "hideEasing": "linear",
|
|
202
|
+ // "showMethod": "fadeIn",
|
|
203
|
+ // "hideMethod": "fadeOut"
|
|
204
|
+ // }
|
|
205
|
+ // }
|
|
206
|
+}
|
|
207
|
+wattantyFunction();
|