Spaces:
Sleeping
Sleeping
gamingflexer
commited on
Commit
·
2ed4a17
1
Parent(s):
4fbc5a4
html filesadded
Browse files
src/app/api/templates/_base.html
ADDED
File without changes
|
src/app/api/templates/catalouge.html
CHANGED
@@ -20,42 +20,52 @@
|
|
20 |
.card {
|
21 |
margin-bottom: 20px;
|
22 |
}
|
|
|
|
|
|
|
|
|
23 |
</style>
|
24 |
</head>
|
25 |
<header>
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
</
|
|
|
32 |
<body>
|
33 |
|
34 |
<div class="container catalogue-container">
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
54 |
</div>
|
55 |
</div>
|
56 |
</div>
|
57 |
-
{% endfor %}
|
58 |
</div>
|
|
|
|
|
|
|
59 |
</div>
|
60 |
|
61 |
<!-- Include Bootstrap JS and its dependencies -->
|
|
|
20 |
.card {
|
21 |
margin-bottom: 20px;
|
22 |
}
|
23 |
+
.voice-edit-btn:hover {
|
24 |
+
text-decoration: none; /* Remove underline on hover */
|
25 |
+
color: #007bff; /* Change text color on hover */
|
26 |
+
}
|
27 |
</style>
|
28 |
</head>
|
29 |
<header>
|
30 |
+
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
31 |
+
<div class="container">
|
32 |
+
<a class="navbar-brand" href="{% url 'index' %}" style="font-weight: bold;">HomePage</a>
|
33 |
+
<a href="{% url 'add_product_by_image' %}" class="btn btn-primary ml-1" style="padding: 0.5rem 1rem; font-size: 1rem;">Add a Product by Image</a>
|
34 |
+
</div>
|
35 |
+
</nav>
|
36 |
+
</header>
|
37 |
<body>
|
38 |
|
39 |
<div class="container catalogue-container">
|
40 |
+
<div class="search-bar-container">
|
41 |
+
<form class="form-inline my-2 my-lg-0" method="GET" action="{% url 'index' %}">
|
42 |
+
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search" name="q" value="{{ request.GET.q }}">
|
43 |
+
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
|
44 |
+
</form>
|
45 |
+
<span id="product-count">Number of Products: {{ products|length }}</span>
|
46 |
+
</div>
|
47 |
+
<div class="row" id="product-row">
|
48 |
+
<!-- Product cards will be inserted here -->
|
49 |
+
{% for product in products %}
|
50 |
+
<div class="col-md-4">
|
51 |
+
<div class="card">
|
52 |
+
{% if product.first_image_url %}
|
53 |
+
<img class="card-img-top" src="{{ product.first_image_url }}" alt="Product Image">
|
54 |
+
{% endif %}
|
55 |
+
<div class="card-body">
|
56 |
+
<h5 class="card-title">{{ product.product_name }}</h5>
|
57 |
+
<p class="card-text">Description: {{ product.description }}</p>
|
58 |
+
<p class="card-text">Brand: {{ product.brand }}</p>
|
59 |
+
<div class="d-flex justify-content-between align-items-center">
|
60 |
+
<a href="{% url 'product_detail' product.id %}" class="btn btn-primary btn-sm mb-2">View Details</a>
|
61 |
+
<a href="{% url 'voice_product_detail' product.id %}" class="btn btn-secondary btn-sm mb-2">Voice Edit</a>
|
62 |
</div>
|
63 |
</div>
|
64 |
</div>
|
|
|
65 |
</div>
|
66 |
+
{% endfor %}
|
67 |
+
</div>
|
68 |
+
|
69 |
</div>
|
70 |
|
71 |
<!-- Include Bootstrap JS and its dependencies -->
|
src/app/api/templates/edit_voice_product.html
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- edit_voice_product.html -->
|
2 |
+
|
3 |
+
<!DOCTYPE html>
|
4 |
+
<html lang="en">
|
5 |
+
<head>
|
6 |
+
<meta charset="UTF-8">
|
7 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
8 |
+
<title>Edit Voice Product</title>
|
9 |
+
<!-- Include necessary CSS or stylesheets -->
|
10 |
+
</head>
|
11 |
+
<body>
|
12 |
+
<h1>Edit Voice Product</h1>
|
13 |
+
|
14 |
+
<div id="recording-status"></div>
|
15 |
+
<button id="record-button">Start Recording</button>
|
16 |
+
|
17 |
+
<form id="voice-form" method="post" enctype="multipart/form-data">
|
18 |
+
{% csrf_token %}
|
19 |
+
<input type="file" id="voice-file" name="voice_file" style="display: none;">
|
20 |
+
<button type="submit" id="submit-button" style="display: none;">Submit</button>
|
21 |
+
</form>
|
22 |
+
|
23 |
+
<!-- Include necessary JavaScript -->
|
24 |
+
<script>
|
25 |
+
const recordButton = document.getElementById('record-button');
|
26 |
+
const recordingStatus = document.getElementById('recording-status');
|
27 |
+
const voiceForm = document.getElementById('voice-form');
|
28 |
+
const voiceFileInput = document.getElementById('voice-file');
|
29 |
+
const submitButton = document.getElementById('submit-button');
|
30 |
+
let mediaRecorder;
|
31 |
+
let chunks = [];
|
32 |
+
|
33 |
+
recordButton.addEventListener('click', async () => {
|
34 |
+
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
|
35 |
+
try {
|
36 |
+
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
37 |
+
startRecording(stream);
|
38 |
+
} catch (error) {
|
39 |
+
console.error('Error accessing microphone:', error);
|
40 |
+
}
|
41 |
+
} else {
|
42 |
+
console.error('getUserMedia not supported on your browser');
|
43 |
+
}
|
44 |
+
});
|
45 |
+
|
46 |
+
function startRecording(stream) {
|
47 |
+
mediaRecorder = new MediaRecorder(stream);
|
48 |
+
mediaRecorder.ondataavailable = handleDataAvailable;
|
49 |
+
mediaRecorder.start();
|
50 |
+
recordingStatus.innerText = 'Recording...';
|
51 |
+
recordingStatus.style.color = 'red';
|
52 |
+
recordButton.disabled = true;
|
53 |
+
}
|
54 |
+
|
55 |
+
function handleDataAvailable(event) {
|
56 |
+
chunks.push(event.data);
|
57 |
+
}
|
58 |
+
|
59 |
+
mediaRecorder.onstop = async () => {
|
60 |
+
const blob = new Blob(chunks, { 'type' : 'audio/ogg; codecs=opus' });
|
61 |
+
chunks = [];
|
62 |
+
const formData = new FormData();
|
63 |
+
formData.append('voice_file', blob);
|
64 |
+
try {
|
65 |
+
const response = await fetch('/edit-voice-product/', {
|
66 |
+
method: 'POST',
|
67 |
+
body: formData,
|
68 |
+
});
|
69 |
+
if (response.ok) {
|
70 |
+
console.log('Voice file submitted successfully');
|
71 |
+
// Optionally, you can redirect or show a success message
|
72 |
+
} else {
|
73 |
+
console.error('Failed to submit voice file');
|
74 |
+
}
|
75 |
+
} catch (error) {
|
76 |
+
console.error('Error submitting voice file:', error);
|
77 |
+
}
|
78 |
+
};
|
79 |
+
|
80 |
+
mediaRecorder.onpause = () => {
|
81 |
+
recordingStatus.innerText = 'Recording paused';
|
82 |
+
recordingStatus.style.color = 'grey';
|
83 |
+
};
|
84 |
+
|
85 |
+
voiceForm.addEventListener('submit', () => {
|
86 |
+
mediaRecorder.stop();
|
87 |
+
});
|
88 |
+
</script>
|
89 |
+
</body>
|
90 |
+
</html>
|
src/app/api/templates/record.html
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--inherits the layout-->
|
2 |
+
{% extends '_base.html' %}
|
3 |
+
<!--static-->
|
4 |
+
{% load static %}
|
5 |
+
<!--title-->
|
6 |
+
{% block title %}{{page_title}}{% endblock title %}
|
7 |
+
|
8 |
+
<!--additional css-->
|
9 |
+
|
10 |
+
{% block css %}
|
11 |
+
<link href="{% static 'assets/css/video-js.css' %}" rel="stylesheet" />
|
12 |
+
<link href="{% static 'assets/css/all.min.css' %}" rel="stylesheet" />
|
13 |
+
<link
|
14 |
+
href="{% static 'assets/css/videojs.wavesurfer.min.css' %}"
|
15 |
+
rel="stylesheet"
|
16 |
+
/>
|
17 |
+
<link href="{% static 'assets/css/videojs.record.css' %}" rel="stylesheet" />
|
18 |
+
<style>
|
19 |
+
/* change player background color */
|
20 |
+
#recordAudio {
|
21 |
+
background-color: #3e8ed0;
|
22 |
+
}
|
23 |
+
</style>
|
24 |
+
{% endblock css %}
|
25 |
+
<!--content-->
|
26 |
+
{% block content %}
|
27 |
+
<section class="section">
|
28 |
+
<div class="container">
|
29 |
+
<div class="columns">
|
30 |
+
<div class="column is-offset-4 is-4">
|
31 |
+
<h1 class="title">Record audio</h1>
|
32 |
+
<article class="message is-success" id="alert">
|
33 |
+
<div class="message-header">
|
34 |
+
<p>Recorded successfully!</p>
|
35 |
+
<button class="delete" aria-label="delete"></button>
|
36 |
+
</div>
|
37 |
+
<div class="message-body">
|
38 |
+
You have successfully recorded your message. You can now click on
|
39 |
+
the Submit button to post it.
|
40 |
+
</div>
|
41 |
+
</article>
|
42 |
+
<form method="POST" enctype="multipart/form-data">
|
43 |
+
{% csrf_token %}
|
44 |
+
<div class="field">
|
45 |
+
<div class="control has-icons-left has-icons-right">
|
46 |
+
<input
|
47 |
+
class="input"
|
48 |
+
type="text"
|
49 |
+
placeholder="Language"
|
50 |
+
name="language"
|
51 |
+
id="language"
|
52 |
+
/>
|
53 |
+
<span class="icon is-left">
|
54 |
+
<i class="fas fa-language"></i>
|
55 |
+
</span>
|
56 |
+
<span class="icon is-right">
|
57 |
+
<i class="fas fa-check"></i>
|
58 |
+
</span>
|
59 |
+
</div>
|
60 |
+
<div
|
61 |
+
class="control has-icons-left has-icons-right"
|
62 |
+
style="margin-top: 1rem"
|
63 |
+
>
|
64 |
+
<audio id="recordAudio" class="video-js vjs-default-skin"></audio>
|
65 |
+
</div>
|
66 |
+
<div class="control" style="margin-top: 1rem">
|
67 |
+
<button class="button is-info" id="submit">Submit</button>
|
68 |
+
</div>
|
69 |
+
</div>
|
70 |
+
</form>
|
71 |
+
</div>
|
72 |
+
</div>
|
73 |
+
</div>
|
74 |
+
</section>
|
75 |
+
{% endblock content %}
|
76 |
+
|
77 |
+
<!--additional js-->
|
78 |
+
{% block js %}
|
79 |
+
<script src="{% static 'assets/js/video.min.js' %}"></script>
|
80 |
+
<script src="{% static 'assets/js/RecordRTC.js' %}"></script>
|
81 |
+
<script src="{% static 'assets/js/adapter-latest.js' %}"></script>
|
82 |
+
<script src="{% static 'assets/js/wavesurfer.js' %}"></script>
|
83 |
+
<script src="{% static 'assets/js/wavesurfer.microphone.min.js' %}"></script>
|
84 |
+
<script src="{% static 'assets/js/videojs.wavesurfer.min.js' %}"></script>
|
85 |
+
|
86 |
+
<script src="{% static 'assets/js/videojs.record.min.js' %}"></script>
|
87 |
+
<script src="{% static 'assets/js/browser-workaround.js' %}"></script>
|
88 |
+
<script src="{% static 'assets/js/real.recording.js' %}"></script>
|
89 |
+
{% endblock js %}
|
src/app/api/templates/record_detail.html
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--inherits the layout-->
|
2 |
+
{% extends '_base.html' %}
|
3 |
+
<!--static-->
|
4 |
+
{% load static %}
|
5 |
+
<!--title-->
|
6 |
+
{% block title %}{{page_title}}{% endblock title %}
|
7 |
+
|
8 |
+
<!--additional css-->
|
9 |
+
|
10 |
+
<!--content-->
|
11 |
+
{% block content %}
|
12 |
+
<section class="section">
|
13 |
+
<div class="container">
|
14 |
+
<div class="columns">
|
15 |
+
<div class="column is-offset-4 is-4">
|
16 |
+
<h1 class="title">Recorded audio</h1>
|
17 |
+
<div class="card">
|
18 |
+
<div class="card-image">
|
19 |
+
<audio src="{{record.voice_record.url}}" controls></audio>
|
20 |
+
</div>
|
21 |
+
<div class="card-content">
|
22 |
+
<div class="content">
|
23 |
+
<p>Language: {{record.language}}</p>
|
24 |
+
</div>
|
25 |
+
</div>
|
26 |
+
</div>
|
27 |
+
</div>
|
28 |
+
</div>
|
29 |
+
</div>
|
30 |
+
</section>
|
31 |
+
{% endblock content %}
|
src/app/api/templates/upload_image.html
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Upload Image</title>
|
7 |
+
<!-- Include Bootstrap CSS -->
|
8 |
+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
9 |
+
</head>
|
10 |
+
<body>
|
11 |
+
<div class="container mt-5">
|
12 |
+
<h1 class="text-center">Upload Image</h1>
|
13 |
+
<form id="upload-form" method="post" enctype="multipart/form-data">
|
14 |
+
{% csrf_token %}
|
15 |
+
<div class="form-group">
|
16 |
+
<label for="images">Choose Images:</label>
|
17 |
+
<input type="file" class="form-control-file" id="images" name="images" multiple>
|
18 |
+
</div>
|
19 |
+
<button type="submit" class="btn btn-primary">Submit</button>
|
20 |
+
</form>
|
21 |
+
<!-- Display product details for editing -->
|
22 |
+
<div id="edit-product" style="display: none;">
|
23 |
+
<h2 class="mt-4">Edit Product</h2>
|
24 |
+
<form id="edit-product-form">
|
25 |
+
{% csrf_token %}
|
26 |
+
<div class="form-group">
|
27 |
+
<label for="barcode">Barcode:</label>
|
28 |
+
<input type="text" class="form-control" id="barcode" name="barcode">
|
29 |
+
</div>
|
30 |
+
<div class="form-group">
|
31 |
+
<label for="brand">Brand:</label>
|
32 |
+
<input type="text" class="form-control" id="brand" name="brand">
|
33 |
+
</div>
|
34 |
+
<div class="form-group">
|
35 |
+
<label for="sub_brand">Sub Brand:</label>
|
36 |
+
<input type="text" class="form-control" id="sub_brand" name="sub_brand">
|
37 |
+
</div>
|
38 |
+
<div class="form-group">
|
39 |
+
<label for="manufacturer">Manufacturer:</label>
|
40 |
+
<input type="text" class="form-control" id="manufacturer" name="manufactured_by">
|
41 |
+
</div>
|
42 |
+
<div class="form-group">
|
43 |
+
<label for="product_name">Product Name:</label>
|
44 |
+
<input type="text" class="form-control" id="product_name" name="product_name">
|
45 |
+
</div>
|
46 |
+
<div class="form-group">
|
47 |
+
<label for="weight">Weight:</label>
|
48 |
+
<input type="text" class="form-control" id="weight" name="weight">
|
49 |
+
</div>
|
50 |
+
<div class="form-group">
|
51 |
+
<label for="variant">Variant:</label>
|
52 |
+
<input type="text" class="form-control" id="variant" name="variant">
|
53 |
+
</div>
|
54 |
+
<div class="form-group">
|
55 |
+
<label for="net_content">Net Content:</label>
|
56 |
+
<input type="text" class="form-control" id="net_content" name="net_content">
|
57 |
+
</div>
|
58 |
+
<div class="form-group">
|
59 |
+
<label for="price">Price:</label>
|
60 |
+
<input type="text" class="form-control" id="price" name="price">
|
61 |
+
</div>
|
62 |
+
<div class="form-group">
|
63 |
+
<label for="parent_category">Parent Category:</label>
|
64 |
+
<input type="text" class="form-control" id="parent_category" name="parent_category">
|
65 |
+
</div>
|
66 |
+
<div class="form-group">
|
67 |
+
<label for="child_category">Child Category:</label>
|
68 |
+
<input type="text" class="form-control" id="child_category" name="child_category">
|
69 |
+
</div>
|
70 |
+
<div class="form-group">
|
71 |
+
<label for="sub_child_category">Sub Child Category:</label>
|
72 |
+
<input type="text" class="form-control" id="sub_child_category" name="sub_child_category">
|
73 |
+
</div>
|
74 |
+
<div class="form-group">
|
75 |
+
<label for="description">Description:</label>
|
76 |
+
<textarea class="form-control" id="description" name="description"></textarea>
|
77 |
+
</div>
|
78 |
+
<div class="form-group">
|
79 |
+
<label for="quantity">Quantity:</label>
|
80 |
+
<input type="text" class="form-control" id="quantity" name="quantity">
|
81 |
+
</div>
|
82 |
+
<div class="form-group">
|
83 |
+
<label for="mrp">MRP:</label>
|
84 |
+
<input type="text" class="form-control" id="mrp" name="mrp">
|
85 |
+
</div>
|
86 |
+
<!-- Add image input if needed -->
|
87 |
+
<button type="submit" class="btn btn-primary">Save</button>
|
88 |
+
</form>
|
89 |
+
</div>
|
90 |
+
|
91 |
+
<!-- Display product details here -->
|
92 |
+
<div class="mt-4" id="product-details">
|
93 |
+
<h2>Product Details</h2>
|
94 |
+
<ul id="product-details-list">
|
95 |
+
<!-- Product details will be added dynamically here -->
|
96 |
+
</ul>
|
97 |
+
</div>
|
98 |
+
</div>
|
99 |
+
|
100 |
+
<!-- Include jQuery for AJAX -->
|
101 |
+
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
102 |
+
<script>
|
103 |
+
$(document).ready(function() {
|
104 |
+
// Submit form via AJAX when image is uploaded
|
105 |
+
$('#upload-form').submit(function(event) {
|
106 |
+
event.preventDefault();
|
107 |
+
var formData = new FormData($(this)[0]);
|
108 |
+
|
109 |
+
$.ajax({
|
110 |
+
url: $(this).attr('action'),
|
111 |
+
type: $(this).attr('method'),
|
112 |
+
data: formData,
|
113 |
+
processData: false,
|
114 |
+
contentType: false,
|
115 |
+
success: function(response) {
|
116 |
+
// Display product details
|
117 |
+
displayProductDetails(response);
|
118 |
+
// Show edit product form
|
119 |
+
$('#edit-product').show();
|
120 |
+
},
|
121 |
+
error: function(xhr, status, error) {
|
122 |
+
console.log(xhr.responseText);
|
123 |
+
}
|
124 |
+
});
|
125 |
+
});
|
126 |
+
|
127 |
+
// Submit edit product form via AJAX
|
128 |
+
$('#edit-product-form').submit(function(event) {
|
129 |
+
event.preventDefault();
|
130 |
+
var formData = $(this).serialize();
|
131 |
+
|
132 |
+
$.ajax({
|
133 |
+
url: 'http://34.122.223.224:9002/api/products/',
|
134 |
+
type: 'POST',
|
135 |
+
data: formData,
|
136 |
+
success: function(response) {
|
137 |
+
// Optionally, handle success response
|
138 |
+
console.log(response);
|
139 |
+
},
|
140 |
+
error: function(xhr, status, error) {
|
141 |
+
console.log(xhr.responseText);
|
142 |
+
}
|
143 |
+
});
|
144 |
+
});
|
145 |
+
|
146 |
+
function displayProductDetails(details) {
|
147 |
+
$('#product-details-list').empty();
|
148 |
+
$.each(details, function(key, value) {
|
149 |
+
$('#product-details-list').append('<li><strong>' + key + ':</strong> ' + value + '</li>');
|
150 |
+
// Populate edit product form fields
|
151 |
+
$('#edit-product-form').find('[name="' + key + '"]').val(value);
|
152 |
+
});
|
153 |
+
}
|
154 |
+
|
155 |
+
});
|
156 |
+
</script>
|
157 |
+
</body>
|
158 |
+
</html>
|