Update templates/customer_details.html
Browse files
templates/customer_details.html
CHANGED
@@ -68,7 +68,7 @@
|
|
68 |
.change-btn, .copy-btn {
|
69 |
position: absolute;
|
70 |
right: 10px;
|
71 |
-
top: 70%;
|
72 |
transform: translateY(-50%);
|
73 |
color: #FF0000;
|
74 |
font-size: 0.75rem;
|
@@ -96,7 +96,7 @@
|
|
96 |
.update-btn {
|
97 |
width: 100%;
|
98 |
padding: 12px;
|
99 |
-
background-color: #8B4513;
|
100 |
border-color: #8B4513;
|
101 |
color: #FFFFFF;
|
102 |
border: 1px solid;
|
@@ -107,7 +107,7 @@
|
|
107 |
margin-top: 20px;
|
108 |
}
|
109 |
.update-btn:hover {
|
110 |
-
background-color: #5C2D0C;
|
111 |
border-color: #5C2D0C;
|
112 |
}
|
113 |
|
@@ -131,7 +131,7 @@
|
|
131 |
.change-btn, .copy-btn {
|
132 |
font-size: 0.7rem;
|
133 |
padding: 4px 6px;
|
134 |
-
top: 70%;
|
135 |
}
|
136 |
.copy-btn svg {
|
137 |
width: 10px;
|
@@ -157,20 +157,32 @@
|
|
157 |
flagField.value = "true";
|
158 |
});
|
159 |
}
|
|
|
|
|
|
|
|
|
|
|
160 |
}
|
161 |
function onFocusNext(inputField) {
|
162 |
var changeBtn = $(inputField).siblings('.change-btn');
|
163 |
if ($(inputField).prop('readonly')) {
|
164 |
changeBtn.show();
|
165 |
}
|
|
|
|
|
|
|
|
|
|
|
166 |
}
|
167 |
-
function copyReferralCode() {
|
168 |
var referralCode = document.getElementById('referralCode').value;
|
169 |
navigator.clipboard.writeText(referralCode).then(() => {
|
170 |
-
|
|
|
|
|
|
|
171 |
}).catch(err => {
|
172 |
console.error('Failed to copy: ', err);
|
173 |
-
alert('Failed to copy referral code.');
|
174 |
});
|
175 |
}
|
176 |
function updateProfile(event) {
|
@@ -260,12 +272,12 @@
|
|
260 |
<div class="form-group">
|
261 |
<label for="referralCode">Referral Code</label>
|
262 |
<input type="text" id="referralCode" name="referralCode" value="{{ customer['referral_code'] }}" readonly>
|
263 |
-
<span class="copy-btn" onclick="copyReferralCode()">
|
264 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
265 |
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
266 |
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
267 |
</svg>
|
268 |
-
COPY
|
269 |
</span>
|
270 |
</div>
|
271 |
|
|
|
68 |
.change-btn, .copy-btn {
|
69 |
position: absolute;
|
70 |
right: 10px;
|
71 |
+
top: 70%;
|
72 |
transform: translateY(-50%);
|
73 |
color: #FF0000;
|
74 |
font-size: 0.75rem;
|
|
|
96 |
.update-btn {
|
97 |
width: 100%;
|
98 |
padding: 12px;
|
99 |
+
background-color: #8B4513;
|
100 |
border-color: #8B4513;
|
101 |
color: #FFFFFF;
|
102 |
border: 1px solid;
|
|
|
107 |
margin-top: 20px;
|
108 |
}
|
109 |
.update-btn:hover {
|
110 |
+
background-color: #5C2D0C;
|
111 |
border-color: #5C2D0C;
|
112 |
}
|
113 |
|
|
|
131 |
.change-btn, .copy-btn {
|
132 |
font-size: 0.7rem;
|
133 |
padding: 4px 6px;
|
134 |
+
top: 70%;
|
135 |
}
|
136 |
.copy-btn svg {
|
137 |
width: 10px;
|
|
|
157 |
flagField.value = "true";
|
158 |
});
|
159 |
}
|
160 |
+
['customerName', 'phone', 'email'].forEach(function(id) {
|
161 |
+
if (id !== fieldId && $('#' + id).prop('readonly')) {
|
162 |
+
$('#' + id).siblings('.change-btn').show();
|
163 |
+
}
|
164 |
+
});
|
165 |
}
|
166 |
function onFocusNext(inputField) {
|
167 |
var changeBtn = $(inputField).siblings('.change-btn');
|
168 |
if ($(inputField).prop('readonly')) {
|
169 |
changeBtn.show();
|
170 |
}
|
171 |
+
['customerName', 'phone', 'email'].forEach(function(id) {
|
172 |
+
if ($('#' + id).prop('readonly') && id !== $(inputField).attr('id')) {
|
173 |
+
$('#' + id).siblings('.change-btn').show();
|
174 |
+
}
|
175 |
+
});
|
176 |
}
|
177 |
+
function copyReferralCode(button) {
|
178 |
var referralCode = document.getElementById('referralCode').value;
|
179 |
navigator.clipboard.writeText(referralCode).then(() => {
|
180 |
+
$(button).find('span').text('COPIED');
|
181 |
+
setTimeout(() => {
|
182 |
+
$(button).find('span').text('COPY');
|
183 |
+
}, 2000);
|
184 |
}).catch(err => {
|
185 |
console.error('Failed to copy: ', err);
|
|
|
186 |
});
|
187 |
}
|
188 |
function updateProfile(event) {
|
|
|
272 |
<div class="form-group">
|
273 |
<label for="referralCode">Referral Code</label>
|
274 |
<input type="text" id="referralCode" name="referralCode" value="{{ customer['referral_code'] }}" readonly>
|
275 |
+
<span class="copy-btn" onclick="copyReferralCode(this)">
|
276 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
277 |
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
278 |
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
279 |
</svg>
|
280 |
+
<span>COPY</span>
|
281 |
</span>
|
282 |
</div>
|
283 |
|