Update templates/customer_details.html
Browse files
templates/customer_details.html
CHANGED
@@ -64,7 +64,7 @@
|
|
64 |
.form-group input[readonly] {
|
65 |
background-color: #F5F7FA;
|
66 |
}
|
67 |
-
.change-btn {
|
68 |
position: absolute;
|
69 |
right: 10px;
|
70 |
top: 50%;
|
@@ -78,8 +78,11 @@
|
|
78 |
border-radius: 5px;
|
79 |
background-color: rgba(255, 255, 255, 0.8);
|
80 |
transition: opacity 0.3s ease;
|
|
|
|
|
|
|
81 |
}
|
82 |
-
.change-btn:hover {
|
83 |
opacity: 0.8;
|
84 |
}
|
85 |
.change-btn.disabled {
|
@@ -87,12 +90,16 @@
|
|
87 |
cursor: not-allowed;
|
88 |
background-color: rgba(255, 255, 255, 0.5);
|
89 |
}
|
|
|
|
|
|
|
|
|
90 |
.update-btn {
|
91 |
width: 100%;
|
92 |
padding: 12px;
|
93 |
background-color: #8B4513; /* Brown */
|
94 |
border-color: #8B4513;
|
95 |
-
color: #FFFFFF;
|
96 |
border: 1px solid;
|
97 |
border-radius: 10px;
|
98 |
font-size: 1rem;
|
@@ -122,10 +129,14 @@
|
|
122 |
font-size: 0.9rem;
|
123 |
padding: 8px;
|
124 |
}
|
125 |
-
.change-btn {
|
126 |
font-size: 0.7rem;
|
127 |
padding: 4px 6px;
|
128 |
}
|
|
|
|
|
|
|
|
|
129 |
.update-btn {
|
130 |
padding: 10px;
|
131 |
font-size: 0.9rem;
|
@@ -138,7 +149,7 @@
|
|
138 |
var field = document.getElementById(fieldId);
|
139 |
var flagField = document.getElementById(flagId);
|
140 |
var changeBtn = $(field).siblings('.change-btn');
|
141 |
-
changeBtn.hide();
|
142 |
if (flagField.value === "false") {
|
143 |
field.removeAttribute("readonly");
|
144 |
field.focus();
|
@@ -150,9 +161,18 @@
|
|
150 |
function onFocusNext(inputField) {
|
151 |
var changeBtn = $(inputField).siblings('.change-btn');
|
152 |
if ($(inputField).prop('readonly')) {
|
153 |
-
changeBtn.show();
|
154 |
}
|
155 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
function updateProfile(event) {
|
157 |
event.preventDefault();
|
158 |
var phone = $('#phone').val().trim();
|
@@ -239,7 +259,14 @@
|
|
239 |
|
240 |
<div class="form-group">
|
241 |
<label for="referralCode">Referral Code</label>
|
242 |
-
<input type="text" id="referralCode" name="referralCode" value="{{ customer['referral_code'] }}">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
</div>
|
244 |
|
245 |
<button type="submit" class="update-btn">Update profile</button>
|
|
|
64 |
.form-group input[readonly] {
|
65 |
background-color: #F5F7FA;
|
66 |
}
|
67 |
+
.change-btn, .copy-btn {
|
68 |
position: absolute;
|
69 |
right: 10px;
|
70 |
top: 50%;
|
|
|
78 |
border-radius: 5px;
|
79 |
background-color: rgba(255, 255, 255, 0.8);
|
80 |
transition: opacity 0.3s ease;
|
81 |
+
display: flex;
|
82 |
+
align-items: center;
|
83 |
+
gap: 4px;
|
84 |
}
|
85 |
+
.change-btn:hover, .copy-btn:hover {
|
86 |
opacity: 0.8;
|
87 |
}
|
88 |
.change-btn.disabled {
|
|
|
90 |
cursor: not-allowed;
|
91 |
background-color: rgba(255, 255, 255, 0.5);
|
92 |
}
|
93 |
+
.copy-btn svg {
|
94 |
+
width: 12px;
|
95 |
+
height: 12px;
|
96 |
+
}
|
97 |
.update-btn {
|
98 |
width: 100%;
|
99 |
padding: 12px;
|
100 |
background-color: #8B4513; /* Brown */
|
101 |
border-color: #8B4513;
|
102 |
+
color: #FFFFFF;
|
103 |
border: 1px solid;
|
104 |
border-radius: 10px;
|
105 |
font-size: 1rem;
|
|
|
129 |
font-size: 0.9rem;
|
130 |
padding: 8px;
|
131 |
}
|
132 |
+
.change-btn, .copy-btn {
|
133 |
font-size: 0.7rem;
|
134 |
padding: 4px 6px;
|
135 |
}
|
136 |
+
.copy-btn svg {
|
137 |
+
width: 10px;
|
138 |
+
height: 10px;
|
139 |
+
}
|
140 |
.update-btn {
|
141 |
padding: 10px;
|
142 |
font-size: 0.9rem;
|
|
|
149 |
var field = document.getElementById(fieldId);
|
150 |
var flagField = document.getElementById(flagId);
|
151 |
var changeBtn = $(field).siblings('.change-btn');
|
152 |
+
changeBtn.hide();
|
153 |
if (flagField.value === "false") {
|
154 |
field.removeAttribute("readonly");
|
155 |
field.focus();
|
|
|
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 |
+
alert('Referral code copied to clipboard!');
|
171 |
+
}).catch(err => {
|
172 |
+
console.error('Failed to copy: ', err);
|
173 |
+
alert('Failed to copy referral code.');
|
174 |
+
});
|
175 |
+
}
|
176 |
function updateProfile(event) {
|
177 |
event.preventDefault();
|
178 |
var phone = $('#phone').val().trim();
|
|
|
259 |
|
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 |
|
272 |
<button type="submit" class="update-btn">Update profile</button>
|