manual item upload

This commit is contained in:
Frank John Begornia
2019-05-17 15:55:38 +08:00
parent c39fb0a2a4
commit 30962d3b4e
26 changed files with 960 additions and 98 deletions

View File

@@ -229,19 +229,19 @@
</div>
@if(($template->Type == "Jersey" || $template->Type == "Shirts") && $template->Side == "Front")
<canvas id="canvas_{{ $template->Type }}_{{ $template->Side }}" width="222px" height="380px" style="margin-top:36px; margin-left: -3px;"></canvas>
<canvas id="canvas_{{ $template->Type }}_{{ $template->Side }}" width="222px" height="380px" style="margin-top:42px; margin-left: 0px;"></canvas>
@endif
@if(($template->Type == "Jersey" || $template->Type == "Shirts") && $template->Side == "Back")
<canvas id="canvas_{{ $template->Type }}_{{ $template->Side }}" width="221.107px" height="379.04px" style="margin-top:24px;"></canvas>
<canvas id="canvas_{{ $template->Type }}_{{ $template->Side }}" width="221.107px" height="379.04px" style="margin-top:16px; margin-left:-1px;"></canvas>
@endif
@if($template->Type == "Shorts" && $template->Side == "Right")
<canvas id="canvas_{{ $template->Type }}_{{ $template->Side }}" width="157.933px" height="315.863px" style="margin-top:188px; margin-left: 0px;" ></canvas>
<canvas id="canvas_{{ $template->Type }}_{{ $template->Side }}" width="157.933px" height="315.863px" style="margin-top:175px; margin-left: 0px;" ></canvas>
@endif
@if($template->Type == "Shorts" && $template->Side == "Left")
<canvas id="canvas_{{ $template->Type }}_{{ $template->Side }}" width="157.933px" height="315.863px" style="margin-top:188px; margin-left: 0px;" ></canvas>
<canvas id="canvas_{{ $template->Type }}_{{ $template->Side }}" width="157.933px" height="315.863px" style="margin-top:175px; margin-left: 0px;" ></canvas>
@endif
@if($template->Type == "Shirts" && $template->Side == "Right")
@@ -1489,7 +1489,13 @@
canvas = window[$(this).attr('data-canvas-id')];
canvasID = $(this).attr('data-canvas-id');
canvas.calcOffset();
// initCanvas();
initCanvas();
canvas.on('object:moving', function(options) {
console.log('asdasd')
});
// canvas.on('selection:cleared', onDeSelected);
// canvas.on('object:selected', onSelected);
});
//trigger enter ######################################################################
@@ -1592,13 +1598,12 @@
options.target.set({
left: canvas.width / 2 - options.target.getWidth() / 2,
}).setCoords();
// console.log(canvasID.split("_")[2] + "_" +canvasID.split("_")[1] + "_Border")
// $("#"+canvasID.split("_")[2] + "_" +canvasID.split("_")[1] + "_Border").css({ "display" : "" });
document.getElementById(canvasID.split("_")[2] + "_" +canvasID.split("_")[1] + "_Border").setAttribute("display", "");
}
console.log('asdasd')
});
canvas.on('object:rotating', onRotating);
@@ -1707,7 +1712,7 @@
// console.log("Height =", (obj.getScaleY() * obj.getHeight()).toFixed(2));
// console.log("Width = ", (obj.getScaleX() * obj.getWidth()).toFixed(2));
// console.log('left-', obj.left, 'top-', obj.top);
console.log('left-', obj.left, 'top-', obj.top);
// console.log('font-', obj.fontSize);
if(obj != null){
@@ -1942,6 +1947,13 @@
window.addEventListener("keydown", processKeys, false);
// end arrow keys navigations
// window.addEventListener("mousemove", myFunction, false);
// function myFunction(){
// console.log('asda')
// }
//remove object
$(document).on('button click', '.remove', function() {
var object = canvas.getActiveObject();
@@ -2651,7 +2663,7 @@
var defNameShortLeft = new fabric.Text(defaultNumber, {
idNumber:"NumberLeftShorts",
top: 278.35,
top: 235.35,
fontSize: 62.50, // 71.25 for default font size. equivalent 2.5"
//height: fabric.util.parseUnit('1in'),
fill: '#000000',
@@ -2673,7 +2685,7 @@
var defNameShortRight = new fabric.Text(defaultNumber, {
idNumber:"NumberRightShorts",
top: 278.35,
top: 235.35,
fontSize: 62.50, // 71.25 for default font size. equivalent 2.5"
//height: fabric.util.parseUnit('1in'),
fill: '#000000',
@@ -3013,7 +3025,7 @@
}
function getClipartProperties(arrayPathId, randomNumbers) {
console.log(arrayPathId);
// console.log(arrayPathId);
$.ajax({ //create an ajax request to load_page.php
type: "POST",
@@ -3044,7 +3056,7 @@
// END 4TH TAB
// 5TH TAB
// for upload image
// for upload image
document.getElementById('upload-images').onchange = function handleImage(e) {
console.log(event);
var reader = new FileReader();
@@ -3913,8 +3925,8 @@
]
});
}
//################### E N D C O L O R P A L E T T E S #######################//
function myCart(){
$.ajax({ //create an ajax request to load_page.php

View File

@@ -1,50 +1,38 @@
[
[
"rgb(0, 0, 0)",
"rgb(67, 67, 67)",
"rgb(102, 102, 102)",
"rgb(204, 204, 204)",
"rgb(217, 217, 217)",
"rgb(255, 255, 255)"
[
[
"rgb(38, 38, 38)",
"rgb(102, 102, 102)",
"rgb(68, 69, 79)",
"rgb(255, 255, 255)"
],
[
"rgb(152, 0, 0)",
"rgb(255, 0, 0)",
"rgb(255, 153, 0)",
"rgb(255, 255, 0)",
"rgb(0, 255, 0)",
"rgb(0, 255, 255)"
[
"rgb(77, 20, 8)",
"rgb(0, 75, 43)",
"rgb(0, 135, 81)",
"rgb(0, 111, 175)"
],
[
"rgb(74, 134, 232)",
"rgb(0, 0, 255)",
"rgb(153, 0, 255)",
"rgb(255, 0, 255)",
"rgb(230, 184, 175)",
"rgb(244, 204, 204)"
[
"rgb(0, 95, 111)",
"rgb(16, 34, 64)",
"rgb(66, 128, 206)",
"rgb(17, 43, 155)"
],
[
"rgb(252, 229, 205)",
"rgb(255, 242, 204)",
"rgb(217, 234, 211)",
"rgb(208, 224, 227)",
"rgb(201, 218, 248)",
"rgb(207, 226, 243)"
[
"rgb(64, 18, 129)",
"rgb(116, 0, 36)",
"rgb(169, 30, 54)",
"rgb(221, 117, 174)"
],
[
"rgb(217, 210, 233)",
"rgb(234, 209, 220)",
"rgb(221, 126, 107)",
"rgb(234, 153, 153)",
"rgb(249, 203, 156)",
"rgb(255, 229, 153)"
[
"rgb(214, 0, 2)",
"rgb(51, 0, 0)",
"rgb(255, 224, 27)",
"rgb(255, 186, 0)"
],
[
"rgb(182, 215, 168)",
"rgb(162, 196, 201)",
"rgb(164, 194, 244)",
"rgb(159, 197, 232)",
"rgb(180, 167, 214)",
"rgb(213, 166, 189)"
[
"rgb(211, 198, 120)",
"rgb(158, 64, 0)",
"rgb(255, 64, 0)",
"rgb(255, 112, 10)"
]
]
]

View File

@@ -54,9 +54,9 @@
display: block;
margin: 0 auto !important;
/* makes it centered */
max-width: 580px;
max-width: 680px;
padding: 10px;
width: 580px;
width: 680px;
}
/* This should also be a block element, so that it will fill 100% of the .container */
@@ -64,7 +64,7 @@
box-sizing: border-box;
display: block;
margin: 0 auto;
max-width: 580px;
max-width: 680px;
padding: 10px;
}
@@ -352,7 +352,7 @@
<tr>
<td>
<h3 class="align-center"><b>Order Details</b></h3>
<table class="table table-condensed table-bordered" style="width: 100%; border-collapse: collapse; ">
<table class="table table-condensed table-bordered" width="100%" style="width: 100%; border-collapse: collapse; ">
<tr >
<td class="text-center" colspan="2"><b>Payer Information</b></td>
</tr>
@@ -392,10 +392,10 @@
<p>Item Order(s):</p>
@foreach($item_goup_array as $item)
<div style="border: 1px solid #e2e2e2; padding: 10px; margin-bottom: 10px;">
<table role="presentation" border="0" cellpadding="0" cellspacing="0" >
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td align="left">
<td align="left" style="width: 180px;">
@foreach($img_thumb as $img)
@if($img->ProductId == $item->ProductId)
<img style="height: 200px; overflow: hidden; object-fit: contain;" src="{{ config('site_config.prod_private_server_ip') }}/images/{{ $img->Image }}">
@@ -405,7 +405,7 @@
<td>
<div style="font-size: 14px;"><a href="{{ url('teamstore') . '/' . $item->StoreURL . '/' . 'product/' . $item->ProductURL }}">{{ $item->ProductName }}</a></div>
Total Price: ${{ $item->total_price }} &bull; Row(s): {{ $item->qty }}
<table class="table table-condensed table-bordered" style="width: 100%; border-collapse: collapse;">
<table class="table table-condensed table-bordered" width="100%" style="width: 100%; border-collapse: collapse;">
@if($item->FormUsed=="jersey-and-shorts-form")
<tr>
<td><b>Name</b></td>
@@ -420,9 +420,7 @@
<td><b>Size</b></td>
<td><b>Price</b></td>
<td><b>Quantity</b></td>
</tr>
@elseif($item->FormUsed=="quantity-form")
<tr>
<td><b>Price</b></td>

View File

@@ -80,7 +80,9 @@
<!-- <hr class="hr-design"> -->
<div id="displayqty"></div>
<br>
<button class="btn btn-primary pull-right" type="submit" id="btn-add-to-cart"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Add to Cart</button>
@if($product_array[0]->ProductPrice > 0)
<button class="btn btn-primary pull-right" type="submit" id="btn-add-to-cart"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Add to Cart</button>
@endif
</form>
</div>
</div>

View File

@@ -63,7 +63,9 @@
<!-- <hr class="hr-design"> -->
<div id="displayqty"></div>
<br>
<button class="btn btn-primary pull-right" type="submit" id="btn-add-to-cart"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Add to Cart</button>
@if($product_array[0]->ProductPrice > 0)
<button class="btn btn-primary pull-right" type="submit" id="btn-add-to-cart"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Add to Cart</button>
@endif
</form>
</div>
</div>

View File

@@ -72,7 +72,9 @@
<!-- <hr class="hr-design"> -->
<div id="displayqty"></div>
<br>
<button class="btn btn-primary pull-right" type="submit" id="btn-add-to-cart"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Add to Cart</button>
@if($product_array[0]->ProductPrice > 0)
<button class="btn btn-primary pull-right" type="submit" id="btn-add-to-cart"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Add to Cart</button>
@endif
</form>
</div>
</div>

View File

@@ -72,7 +72,9 @@
<!-- <hr class="hr-design"> -->
<div id="displayqty"></div>
<br>
<button class="btn btn-primary pull-right" type="submit" id="btn-add-to-cart"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Add to Cart</button>
@if($product_array[0]->ProductPrice > 0)
<button class="btn btn-primary pull-right" type="submit" id="btn-add-to-cart"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Add to Cart</button>
@endif
</form>
</div>
</div>

View File

@@ -59,7 +59,9 @@
<!-- <hr class="hr-design"> -->
<div id="displayqty"></div>
<br>
<button class="btn btn-primary pull-right" type="submit" id="btn-add-to-cart"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Add to Cart</button>
@if($product_array[0]->ProductPrice > 0)
<button class="btn btn-primary pull-right" type="submit" id="btn-add-to-cart"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Add to Cart</button>
@endif
</form>
</div>
</div>

View File

@@ -59,7 +59,9 @@
<!-- <hr class="hr-design"> -->
<div id="displayqty"></div>
<br>
<button class="btn btn-primary pull-right" type="submit" id="btn-add-to-cart"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Add to Cart</button>
@if($product_array[0]->ProductPrice > 0)
<button class="btn btn-primary pull-right" type="submit" id="btn-add-to-cart"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Add to Cart</button>
@endif
</form>
</div>
</div>

View File

@@ -64,7 +64,9 @@
<!-- <hr class="hr-design"> -->
<div id="displayqty"></div>
<br>
<button class="btn btn-primary pull-right" type="submit" id="btn-add-to-cart"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Add to Cart</button>
@if($product_array[0]->ProductPrice > 0)
<button class="btn btn-primary pull-right" type="submit" id="btn-add-to-cart"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Add to Cart</button>
@endif
</form>
</div>
</div>

View File

@@ -0,0 +1,132 @@
@extends('user-layouts.user_template')
@section('content')
<style>
.hide-bullets {
list-style:none;
margin-left: -40px;
margin-top:20px;
}
</style>
<div class="content-wrapper" style="min-height: 916px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Add Store Item
</h1>
<ol class="breadcrumb">
<li><a href="{{ url('user') }}"><i class="fa fa-home"></i> Home</a></li>
<li><a href="{{ url('user/store-items') }}"><i class="fa fa-th"></i> Store Items</a></li>
<li class="active">Add new Item</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<form id="frm-add-item">
<div class="row">
<div class="col-md-7">
<div class="box box-primary">
<div class="box-body custom-box-body">
<div class="row">
<div class="col-md-12" id="main_thumbnail_uploader">
<div style="min-height:500px;">
<input type="file" id="imgupload" name="imgupload[]" style="display:none;" multiple accept="image/*"/>
<a href="#" id="OpenImgUpload" style="position:absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);" >
<i style="font-size: 125px;" class="fa fa-picture-o"></i>
<div class="text-center"> Add item image(s)</div>
<!-- <div class="gallery"></div> -->
</a>
</div>
</div>
<!-- image preview -->
<div class="col-md-12" id="upload_thumbnail_preview" style="display:none;">
<div class="row">
<div class="col-md-12 text-center">
<img style="height:400px" src="#" id="main-thumbnail">
</div>
</div>
<div class="row">
<div class="col-md-12">
<ul class="hide-bullets small-preview-thumb">
<!-- <li class="col-sm-3 col-xs-3">
<a href="#" class="text-center thumbnail a_thumbnail" id="OpenImgUpload2">
<i style="font-size: 70px;" class="fa fa-picture-o"></i>
<div class="text-center"> Add more image(s)</div>
</a>
</li> -->
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-5">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">
Item Details
</h3>
</div>
<div class="box-body custom-box-body">
<div class="row">
<div class="col-md-12">
<!-- <input type="hidden" class="form-control" name="item_url" placeholder="Item Name"> -->
<div class="form-group">
<div id="add_item_response_msg"></div>
</div>
<div class="form-group">
<label>Item Name</label>
<input type="text" class="form-control" id="itemName" name="itemName" placeholder="Item Name">
</div>
<div class="form-group">
<label>Item Desription</label>
<textarea class="form-control" name="itemDescription"></textarea>
</div>
<div class="form-group">
<label>Item Price</label>
<input id="item_price" name="itemPrice" class="form-control price_format" type="text" data-error="#err-price" />
</div>
<div class="form-group">
<label>Item Form</label>
<select class="form-control" name="itemForm">
<option value="jersey-and-shorts-form">Jersey and Shorts Form</option>
<option value="tshirt-form">T-Shirt Form</option>
<option value="quantity-form">Quantity Form</option>
<option value="name-and-number-form">Name and Number Form</option>
<option value="name-number-size-form">Name, Number and Size Form</option>
<option value="number-form">Number Only Form</option>
</select>
</div>
<div class="form-group">
<label>Item URL</label>
<div class="input-group">
<span class="input-group-addon" id="basic-addon3">{{ url() . "/teamstore/" . $store_array[0]->StoreUrl . '/'}}</span>
<input type="text" class="form-control" id="product_url" name="itemUrl" aria-describedby="basic-addon3" data-error="#err-itemUrl" >
</div>
<span id="err-itemUrl"></span>
</div>
<div class="form-group">
<label>Item Privacy</label>
<select class="form-control" name="itemPrivacy">
<option value="private">Private</option>
<option value="public">Public</option>
</select>
</div>
</div>
</div>
</div>
<div class="box-footer">
<!-- <button type="submit" class="btn btn-default">Cancel</button> -->
<button type="submit" id="btn_submit_new_item" class="btn btn-primary pull-right">Submit</button>
</div>
</div>
</div>
</div>
</form>
</section>
<!-- /.content -->
</div>
@endsection

View File

@@ -92,7 +92,7 @@
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">
Design Details
Item Details
</h3>
</div>
<form id="frm_sell_design">

View File

@@ -35,6 +35,24 @@
<h3 class="box-title">
Item List
</h3>
<div class="box-tools pull-right">
<a href="{{ url('user/store-items/add-item') }}" type="button" class="btn btn-primary btn-sm">
<i class="fa fa-plus"></i> Add new Item
</a>
<!-- <div class="btn-group">
<button type="button" class="btn btn-box-tool dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-wrench"></i></button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div>
<button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button> -->
</div>
</div>
<!-- <form role="form" id="frm-change-password"> -->
<div class="box-body">

View File

@@ -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... &nbsp; <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();

View File

@@ -26,9 +26,9 @@
<div class="row">
<div class="col-md-7">
<div class="box box-primary">
<!-- <div class="box-header with-border">
<a href="" type="button" class="btn btn-default pull-right"><i class="fa fa-trash"></i> Edit Design</a>
</div> -->
<div class="box-header with-border">
<button type="button" class="btn btn-default pull-right" data-toggle="modal" data-target="#myModal"><i class="fa fa-image"></i> Re-arrange thumbnail</button>
</div>
<div class="box-body custom-box-body">
<div class="row">
<div class="col-md-12">
@@ -45,10 +45,17 @@
<div class="col-md-12">
<ul class="hide-bullets">
@foreach($thumbnails_array as $thumbnail)
<li class="col-sm-3 col-xs-3">
<a class="thumbnail a_thumbnail {{ $thumbnail->ImageClass }}">
<li class="col-sm-3 col-xs-4">
<a class="thumbnail a_thumbnail {{ $thumbnail->ImageClass }}" style="border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; margin-bottom: -28px;">
<!-- <span class="close">&times;</span> -->
<img class="img img-responsive product-center image-thumbnails" style="height: 59.45px;" src="{{ config('site_config.prod_private_server_ip') }}/images/{{ $thumbnail->Image }}"/>
</a>
<div class="funkyradio">
<div class="funkyradio-primary">
<input type="radio" id="{{ 'radio-' .$thumbnail->Id }}" data-product-id="{{ $product_array[0]->Id }}" data-id="{{ $thumbnail->Id }}" name="setActive" @if($thumbnail->ImageClass != null) checked @endif />
<label for="{{ 'radio-' .$thumbnail->Id }}" style="border-top-left-radius: 0px; border-top-right-radius: 0px;">active</label>
</div>
</div>
</li>
@endforeach
</ul>
@@ -122,4 +129,48 @@
</section>
<!-- /.content -->
</div>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th></th>
<th>Image</th>
<th class="col-sm-2 text-center">Action</th>
</tr>
</thead>
<tbody id="sortable">
@foreach($thumbnails_array as $thumbnail)
<tr id="{{ 'item-' . $thumbnail->Id }}">
<td class="text-center" style="width: 50px"><i class="fa fa-bars"></i></td>
<td><img class="img img-responsive product-center" style="height: 59.45px;" src="{{ config('site_config.prod_private_server_ip') }}/images/{{ $thumbnail->Image }}"/></td>
<td class="text-center">
<button class="btn btn-default btn-xs btn-edit-clipart" data-id="#"><i class="fa fa-edit"></i></button>
<button class="btn btn-default btn-xs btn-delete-clipart" data-id="#"><i class="fa fa-trash"></i></button>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="btn_save_thumbnail_sorting">Save Changes</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
@endsection