13 $availability => undef
14 $contact_person_username
18 $selected_image_id => undef
22 <& /util/import_javascript.mas, classes => [ 'jquery', 'jquery.dataTables'] &>
23 <& /util/import_css.mas, paths => ['/documents/inc/datatables/jquery.dataTables.css'] &>
25 <& /page/page_title.mas, title => "Catalog Item Details for: $item_name" &>
27 <&| /page/info_section.mas, title=>"Details", collapsible => 1, collapsed=>0 &>
29 <div class="panel panel-default">
30 <div class="panel-body">
32 <div class="col-sm-6">
33 <table class="table table-bordered table-hover">
34 <tr><td><b>Item Type</b></td><td><% $item_type %> </td></tr>
35 <tr><td><b>Species</b></td><td><% $species %> </td></tr>
36 <tr><td><b>Variety</b></td><td><% $variety %> </td></tr>
37 <tr><td><b>Material Type</b></td><td><% $material_type %> </td></tr>
38 <tr><td><b>Category</b></td><td><% $category %></td></tr>
39 <tr><td><b>Additional Info</b></td><td><% $additional_info %></td></tr>
40 <tr><td><b>Material Source</b><td><% $material_source %></td></tr>
41 <tr><td><b>Breeding Program</b></td><td><% $breeding_program %></td></tr>
42 <tr><td><b>Availability</b></td><td><% $availability %></td></tr>
43 <tr><td><b>Contact Person Username</b></td><td><% $contact_person_username %></td></tr>
44 <tr><td><b>Main Detail Page</b></td><td><% $main_page %></td></tr>
47 <div class="col-sm-6">
49 % if ($selected_image_id) {
55 <td><a href="/catalog/view"><p>Go to Catalog Page</p></a></td>
60 % if ($check_vendor_role == 1) {
61 <&| /page/info_section.mas, title => 'Edit or Remove Catalog Item', collapsible=>1, collapsed=>0 &>
62 <div class = "well well-sm">
63 <div class="panel panel-default">
64 <div class="panel-body">
65 <button id="edit_catalog_item_link" class="btn btn-primary btn-sm">Edit Catalog Item</button>
67 <button id="delete_catalog_item_button" class="btn btn-primary btn-sm">Delete Catalog Item</button>
73 <&| /page/info_section.mas, title => 'Add or Remove Image', collapsible=>1, collapsed=>0 &>
74 <div class = "well well-sm">
75 <div class = "panel panel-default">
76 <div class = "panel-body">
77 <div style="overflow:scroll">
78 <table id = "catalog_item_images_table" class="table table-hover table-striped">
87 <div class="modal fade" id="delete_item_success_dialog" name="order_saved_dialog" tabindex="-1" role="dialog" aria-labelledby="deleteItemSuccessDialog">
88 <div class="modal-dialog" role="document">
89 <div class="modal-content">
90 <div class="modal-header">
91 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
92 <h4 class="modal-title" id="deleteItemSuccessDialog">Success</h4>
94 <div class="modal-body">
95 <div class="container-fluid">
97 <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
98 The catalog item was delete.
102 <div class="modal-footer">
103 <button id="dismiss_deleted_message_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
109 <div class="modal fade" id="add_image_message_dialog" name="add_image_message_dialog" tabindex="-1" role="dialog" aria-labelledby="addImageMessageDialog">
110 <div class="modal-dialog" role="document">
111 <div class="modal-content">
112 <div class="modal-header">
113 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
114 <h4 class="modal-title" id="addImageMessageDialog">Success</h4>
116 <div class="modal-body">
117 <div class="container-fluid">
119 <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
120 The image was added successfully.
124 <div class="modal-footer">
125 <button id="dismiss_add_image_message_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close & Reload</button>
131 <div class="modal fade" id="remove_image_message_dialog" name="remove_image_message_dialog" tabindex="-1" role="dialog" aria-labelledby="removeImageMessageDialog">
132 <div class="modal-dialog" role="document">
133 <div class="modal-content">
134 <div class="modal-header">
135 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
136 <h4 class="modal-title" id="removeImageMessageDialog">Success</h4>
138 <div class="modal-body">
139 <div class="container-fluid">
141 <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
142 The image was removed from the catalog item.
146 <div class="modal-footer">
147 <button id="dismiss_remove_image_message_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close & Reload</button>
153 <& /order/edit_catalog_details_dialog.mas, item_name => $item_name, item_id => $item_id, species => $species, variety => $variety, item_type => $item_type, category => $category, material_type => $material_type, material_source => $material_source, breeding_program => $breeding_program, program_id => $program_id, additional_info => $additional_info, contact_person_username => $contact_person_username, item_prop_id => $item_prop_id, availability => $availability &>
158 jQuery(document).ready( function() {
160 var selected_image_id = "<% $selected_image_id %>";
162 var item_images_table = jQuery('#catalog_item_images_table').DataTable( {
166 'ajax': '/ajax/catalog/image_list/' + <% $item_id %>,
168 { title: "Name", "data": "image_name" },
169 { title: "Image", "data": "small_image" },
170 { title: "Description", "data": "image_description"},
171 { title: "Add or Remove Image", "data": "null", "render": function ( data, type, row ) {
172 if (row.image_id == selected_image_id) {
173 return "<a onclick='removeImage()' >Remove</a>"
175 return "<a onclick='addImage(\""+row.image_id+"\")' >Add</a>"
181 jQuery('#delete_catalog_item_button').click( function() {
182 var response = confirm('Really delete this catalog item? This action cannot be undone.');
185 url: '/ajax/catalog/delete',
188 data : {'item_prop_id' : <% $item_prop_id %>},
189 beforeSend: function(response){
190 jQuery('#working_modal').modal('show');
192 success: function(response) {
193 jQuery('#working_modal').modal('hide');
194 if (response.success == 1) {
195 jQuery('#delete_item_success_dialog').modal('show');
197 if (response.error_string) {
198 alert(response.error_string);
205 jQuery("#dismiss_deleted_message_dialog").click(function(){
212 function addImage(image_id){
214 var item_name = '<% $item_name %>';
215 var item_prop_id = '<% $item_prop_id %>';
216 var image_id = image_id;
219 url: '/ajax/catalog/edit_image',
223 'item_name': item_name,
224 'item_prop_id': item_prop_id,
228 beforeSend: function(response){
229 jQuery('#working_modal').modal('show');
231 success: function(response) {
232 jQuery('#working_modal').modal('hide');
233 if (response.success == 1) {
234 jQuery('#add_image_message_dialog').modal('show');
236 if (response.error_string) {
237 alert(response.error_string);
240 error: function(response){
241 jQuery('#working_modal').modal('hide');
242 alert('An error occurred adding image');
246 jQuery("#dismiss_add_image_message_dialog").click(function(){
253 function removeImage(){
255 var item_name = '<% $item_name %>';
256 var item_prop_id = '<% $item_prop_id %>';
257 var image_id = undefined;
260 url: '/ajax/catalog/edit_image',
264 'item_name': item_name,
265 'item_prop_id': item_prop_id,
268 beforeSend: function(response){
269 jQuery('#working_modal').modal('show');
271 success: function(response) {
272 jQuery('#working_modal').modal('hide');
273 if (response.success == 1) {
274 jQuery('#remove_image_message_dialog').modal('show');
276 if (response.error_string) {
277 alert(response.error_string);
280 error: function(response){
281 jQuery('#working_modal').modal('hide');
282 alert('An error occurred removing image');
286 jQuery("#dismiss_remove_image_message_dialog").click(function(){