manual item upload
This commit is contained in:
@@ -357,7 +357,116 @@
|
||||
|
||||
.thumbnail>img {
|
||||
height: 187px;
|
||||
}
|
||||
}
|
||||
|
||||
.funkyradio div {
|
||||
clear: both;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.funkyradio label {
|
||||
width: 100%;
|
||||
border-radius: 3px;
|
||||
border: 1px solid #D1D3D4;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.funkyradio input[type="radio"]:empty,
|
||||
.funkyradio input[type="checkbox"]:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.funkyradio input[type="radio"]:empty ~ label,
|
||||
.funkyradio input[type="checkbox"]:empty ~ label {
|
||||
position: relative;
|
||||
line-height: 2.5em;
|
||||
text-indent: 3.25em;
|
||||
margin-top: 2em;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.funkyradio input[type="radio"]:empty ~ label:before,
|
||||
.funkyradio input[type="checkbox"]:empty ~ label:before {
|
||||
position: absolute;
|
||||
display: block;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
content: '';
|
||||
width: 2.5em;
|
||||
background: #D1D3D4;
|
||||
border-radius: 0 0 0 3px;
|
||||
}
|
||||
|
||||
.funkyradio input[type="radio"]:hover:not(:checked) ~ label,
|
||||
.funkyradio input[type="checkbox"]:hover:not(:checked) ~ label {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.funkyradio input[type="radio"]:hover:not(:checked) ~ label:before,
|
||||
.funkyradio input[type="checkbox"]:hover:not(:checked) ~ label:before {
|
||||
content: '\2714';
|
||||
text-indent: .9em;
|
||||
color: #C2C2C2;
|
||||
}
|
||||
|
||||
.funkyradio input[type="radio"]:checked ~ label,
|
||||
.funkyradio input[type="checkbox"]:checked ~ label {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.funkyradio input[type="radio"]:checked ~ label:before,
|
||||
.funkyradio input[type="checkbox"]:checked ~ label:before {
|
||||
content: '\2714';
|
||||
text-indent: .9em;
|
||||
color: #333;
|
||||
background-color: #ccc;
|
||||
}
|
||||
|
||||
.funkyradio input[type="radio"]:focus ~ label:before,
|
||||
.funkyradio input[type="checkbox"]:focus ~ label:before {
|
||||
box-shadow: 0 0 0 3px #999;
|
||||
}
|
||||
|
||||
.funkyradio-default input[type="radio"]:checked ~ label:before,
|
||||
.funkyradio-default input[type="checkbox"]:checked ~ label:before {
|
||||
color: #333;
|
||||
background-color: #ccc;
|
||||
}
|
||||
|
||||
.funkyradio-primary input[type="radio"]:checked ~ label:before,
|
||||
.funkyradio-primary input[type="checkbox"]:checked ~ label:before {
|
||||
color: #fff;
|
||||
background-color: #337ab7;
|
||||
}
|
||||
|
||||
.funkyradio-success input[type="radio"]:checked ~ label:before,
|
||||
.funkyradio-success input[type="checkbox"]:checked ~ label:before {
|
||||
color: #fff;
|
||||
background-color: #5cb85c;
|
||||
}
|
||||
|
||||
.funkyradio-danger input[type="radio"]:checked ~ label:before,
|
||||
.funkyradio-danger input[type="checkbox"]:checked ~ label:before {
|
||||
color: #fff;
|
||||
background-color: #d9534f;
|
||||
}
|
||||
|
||||
.funkyradio-warning input[type="radio"]:checked ~ label:before,
|
||||
.funkyradio-warning input[type="checkbox"]:checked ~ label:before {
|
||||
color: #fff;
|
||||
background-color: #f0ad4e;
|
||||
}
|
||||
|
||||
.funkyradio-info input[type="radio"]:checked ~ label:before,
|
||||
.funkyradio-info input[type="checkbox"]:checked ~ label:before {
|
||||
color: #fff;
|
||||
background-color: #5bc0de;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
@@ -410,8 +519,112 @@
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
|
||||
<!-- \priceformat -->
|
||||
<script src="{{asset('/public/designer/js/jquery.priceformat.min.js')}}"></script>
|
||||
<!-- jquery-ui js -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
|
||||
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
|
||||
var tr_sortable = $('#sortable');
|
||||
|
||||
tr_sortable.sortable({
|
||||
revert: 100,
|
||||
placeholder: 'placeholder'
|
||||
});
|
||||
|
||||
tr_sortable.disableSelection();
|
||||
|
||||
$('#btn_save_thumbnail_sorting').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var sortable_data = tr_sortable.sortable('serialize');
|
||||
// div_response . text ( 'Save' );
|
||||
console.log(sortable_data);
|
||||
$.ajax({
|
||||
data: sortable_data,
|
||||
type: 'POST',
|
||||
url : "{{ url('user/post/save-thumbnail-ordering') }}",
|
||||
beforeSend:function(xhr){
|
||||
|
||||
var token = $('meta[name="csrf_token"]').attr('content');
|
||||
|
||||
if (token) {
|
||||
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
|
||||
}
|
||||
xhr.setRequestHeader( 'X-Requested-With', 'XMLHttpRequest');
|
||||
},
|
||||
success:function(result) {
|
||||
// div_response.html(result);
|
||||
console.log(result);
|
||||
if(result.success){
|
||||
alert('Thumbnail ordering is succcessfully updated!');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#myModal').on('hidden.bs.modal', function () {
|
||||
location.reload();
|
||||
});
|
||||
|
||||
$('#OpenImgUpload').click(function(){
|
||||
$('#imgupload').trigger('click');
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#OpenImgUpload2').click(function(){
|
||||
// $('#imgupload').trigger('click');
|
||||
|
||||
var getImages = $('#imgupload').val();
|
||||
|
||||
// console.log(getImages);
|
||||
return false;
|
||||
});
|
||||
|
||||
var imagesPreview = function(input) {
|
||||
|
||||
if (input.files) {
|
||||
var filesAmount = input.files.length;
|
||||
$('#main_thumbnail_uploader').css({
|
||||
"display" : "none"
|
||||
});
|
||||
|
||||
$('#upload_thumbnail_preview').css({
|
||||
"display" : ""
|
||||
});
|
||||
|
||||
for (i = 0; i < filesAmount; i++) {
|
||||
var reader = new FileReader();
|
||||
|
||||
if(i == 0){
|
||||
reader.onload = function(event) {
|
||||
$('#main-thumbnail').attr('src', event.target.result);
|
||||
$( ".small-preview-thumb" ).prepend('<li class="col-sm-3 col-xs-3"> ' +
|
||||
'<a class="text-center thumbnail a_thumbnail active"> ' +
|
||||
'<img class="img img-responsive product-center image-thumbnails" style="height: 90px;" src="'+event.target.result+'"/> ' +
|
||||
'</a> ' +
|
||||
'</li>');
|
||||
}
|
||||
}else{
|
||||
reader.onload = function(event) {
|
||||
$( ".small-preview-thumb" ).prepend('<li class="col-sm-3 col-xs-3"> ' +
|
||||
'<a class="text-center thumbnail a_thumbnail"> ' +
|
||||
'<img class="img img-responsive product-center image-thumbnails" style="height: 90px;" src="'+event.target.result+'"/> ' +
|
||||
'</a> ' +
|
||||
'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
reader.readAsDataURL(input.files[i]);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$('#imgupload').on('change', function() {
|
||||
imagesPreview(this);
|
||||
});
|
||||
|
||||
|
||||
$('.price_format').priceFormat({
|
||||
prefix: '$ '
|
||||
});
|
||||
@@ -682,6 +895,45 @@
|
||||
submitHandler: submitFormItemDetails
|
||||
});
|
||||
|
||||
$("#frm-add-item").validate({
|
||||
rules: {
|
||||
imgupload :{
|
||||
required: true
|
||||
},
|
||||
itemName: {
|
||||
required: true
|
||||
},
|
||||
itemDescription: {
|
||||
required: true
|
||||
},
|
||||
item_price: {
|
||||
required: true
|
||||
},
|
||||
item_url: {
|
||||
required: true
|
||||
},
|
||||
item_privacy: {
|
||||
required: true
|
||||
}
|
||||
|
||||
},
|
||||
messages: {},
|
||||
errorPlacement: function(error, element) {
|
||||
var placement = $(element).data('error');
|
||||
|
||||
if (placement) {
|
||||
|
||||
$(placement).append(error)
|
||||
|
||||
}else {
|
||||
|
||||
error.insertAfter(element);
|
||||
|
||||
}
|
||||
},
|
||||
submitHandler: submitFormAddItem
|
||||
});
|
||||
|
||||
$("#frm_verification_code").validate({
|
||||
rules: {
|
||||
verification_code: {
|
||||
@@ -831,7 +1083,8 @@
|
||||
|
||||
});
|
||||
|
||||
$('.image-thumbnails').click(function(){
|
||||
// $('.image-thumbnails').click(function(){
|
||||
$(document).on('button click', '.image-thumbnails', function(){
|
||||
// console.log($(this)[0].firstElementChild.geAttribute('class'))
|
||||
// console.log($(this).attr('src'))
|
||||
$('#main-thumbnail').attr('src', $(this).attr('src'));
|
||||
@@ -853,7 +1106,7 @@
|
||||
url: "http://"+ip+":"+port+"/forceload/"+ $(this).data('dd'),
|
||||
dataType: "json", //expect html to be returned
|
||||
beforeSend: function() {
|
||||
console.log('loading images');
|
||||
// console.log('loading images');
|
||||
},
|
||||
success: function(response){
|
||||
if(response['status'] == "success"){
|
||||
@@ -876,8 +1129,36 @@
|
||||
|
||||
$('#list').click(function(event){event.preventDefault();$('#products .item').addClass('list-group-item');});
|
||||
$('#grid').click(function(event){event.preventDefault();$('#products .item').removeClass('list-group-item');$('#products .item').addClass('grid-group-item');});
|
||||
|
||||
$('input[name="setActive"]').change(function(){
|
||||
if($(this).prop('checked')){
|
||||
|
||||
var product_id = $(this).data('product-id');
|
||||
var id = $(this).data('id');
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : "{{ url('user/update-active-thumbnail') }}",
|
||||
data : {
|
||||
product_id : product_id,
|
||||
id : id
|
||||
},
|
||||
beforeSend:function(xhr){
|
||||
var token = $('meta[name="csrf_token"]').attr('content');
|
||||
|
||||
if (token) {
|
||||
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
|
||||
}
|
||||
xhr.setRequestHeader( 'X-Requested-With', 'XMLHttpRequest');
|
||||
},
|
||||
success : function(response){
|
||||
console.log(response);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}); //end document ready
|
||||
|
||||
// function
|
||||
function getCities(arr, q){
|
||||
@@ -1069,7 +1350,46 @@
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function submitFormAddItem(){
|
||||
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : "{{ url('user/store-items/save-new-item') }}",
|
||||
data : new FormData($('#frm-add-item')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
beforeSend:function(xhr){
|
||||
$("#add_item_response_msg").fadeOut();
|
||||
$("#btn_submit_new_item").html('Saving... <i class="fa fa-spinner fa-spin"></i>');
|
||||
$("#btn_submit_new_item").prop("disabled", true);
|
||||
var token = $('meta[name="csrf_token"]').attr('content');
|
||||
|
||||
if (token) {
|
||||
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
|
||||
}
|
||||
xhr.setRequestHeader( 'X-Requested-With', 'XMLHttpRequest');
|
||||
|
||||
},
|
||||
success : function(response){
|
||||
if(response.success){
|
||||
alert('New item is successfully added.');
|
||||
location.reload();
|
||||
}else{
|
||||
// alert("Something went wrong. Please try again!");
|
||||
$("#add_item_response_msg").html("");
|
||||
$("#add_item_response_msg").fadeIn(1000, function(){
|
||||
$("#add_item_response_msg").html(response.message);
|
||||
$("#btn_submit_new_item").prop("disabled", false);
|
||||
$("#btn_submit_new_item").html('Submit');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function submitFormVerificationCode(){
|
||||
var data = $("#frm_verification_code").serialize();
|
||||
@@ -1145,7 +1465,7 @@
|
||||
xhr.setRequestHeader( 'X-Requested-With', 'XMLHttpRequest');
|
||||
},
|
||||
success : function(response){
|
||||
console.log(response);
|
||||
// console.log(response);
|
||||
if(response.success){
|
||||
alert("Item is successfully added to your store.");
|
||||
location.reload();
|
||||
|
||||
Reference in New Issue
Block a user