formatting date in a kendo listview Template error - kendo-ui

I have a Kendo list view which renders a template the listview has a date field. the problem i am facing is formatting the output on the template which is a date field. my template is like this:
<script type="text/x-kendo-tmpl" id="template">
#if(from_tx === '#User.Identity.Name')
{
#
<div class="chatmsg" >
<p style="word-wrap:break-word;">${msg_tx}</p>
<span class="timestamp">Sent: ${msg_dt}</span>
<span class="timestamp">Seen: ${seen_dt}</span>
</div>
#
}
else{
#
<div class="chatmsg sent">
<p style="word-wrap:break-word;">${msg_tx}</p>
<span class="timestamp">Recieved ${msg_dt}</span>
</div>
#
}#
</script>
i have tried this
#
<div class="chatmsg" >
<p style="word-wrap:break-word;"> "#= kendo.toString(${msg_dt}, 'MM/dd/yyyy') #"</p>
<span class="timestamp">Sent: ${msg_dt}</span>
<span class="timestamp">Seen: ${seen_dt}</span>
</div>
#
but this code gives me a template error..
can Anyone help me out with this problem

i think your msg_dt is not a date object try this
<script type="text/x-kendo-tmpl" id="template">
<div class="chatmsg" >
<p style="word-wrap:break-word;"> "#= kendo.toString(kendo.parseDate(msg_dt, 'yyyy-MM-dd'), 'MM/dd/yyyy') #"</p>
<span class="timestamp">Sent: #= msg_dt #</span>
<span class="timestamp">Seen: #= seen_dt #</span>
</div>
</script>

Related

how to use Jcrop with Laravel

I have watched this https://www.youtube.com/watch?v=aflTCbGdzDc tutorial for using jcrop, but it is for Php, when I'm using it with Laravel, the program stops at Validation, says image filed is required, like I haven't chosen an image, but I do have ! , and I'm seeing the image in the box . Note: when I push the upload button in crop modal, I get this error :
POST http://localhost:8000/server/ctrl.php?fileapi155837244028211 404 (Not Found) , it seems i need to set a post rout , but how ? i don't know . does anyone know how we should work with jcrop in laravel ?
here is my code :
<link href="{{asset('crop-userpic\style.css')}}" rel="stylesheet"/>
<link href="{{asset('crop-userpic\jcrop\jquery.jcrop.min.css')}}" rel="stylesheet"/>
<form method="post" action="{{route('testing')}}" enctype="multipart/form-data">
#csrf
<div class="container">
<div id="userpic" class="userpic">
<div class="js-preview userpic__preview"></div>
<div class="btn btn-success js-fileapi-wrapper">
<div class="js-browse">
<span class="btn-txt">انتخاب عکس</span>
<input type="file" name="image" id="image">
</div>
<div class="js-upload" style="display: none;">
<div class="progress progress-success">
<div class="js-progress bar"></div>
</div>
<span class="btn-txt">در حال بارگذاری</span>
</div>
</div>
</div>
</div>
<div id="popup" class="popup" style="display: none">
<div class="popup__body">
<div class="js-img"></div>
</div>
<div style="margin: 0 0 5px;text-align: center">
<div class="js-upload btn btn_browse btn_browse_small">بارگذاری</div>
</div>
</div>
<input type="submit" name="submit" value="sumbit" />
</form>
<script src="{{asset('crop-userpic\jquery.min.js')}}"></script>
<script src="{{asset('crop-userpic\jquery.easing.min.js')}}"></script>
<script>
var FileAPI = {
debug: true,
media: true,
staticPath: '{{asset('crop-userpic\FileAPI')}}'
};
</script>
<script src="{{asset('crop-userpic\FileAPI\FileAPI.min.js')}}"></script>
<script src="{{asset('crop-userpic\FileAPI\FileAPI.exif.js')}}"></script>
<script src="{{asset('crop-userpic\jquery.Fileapi.js')}}"></script>
<script src="{{asset('crop-userpic\jcrop\jquery.Jcrop.min.js')}}"></script>
<script src="{{asset('crop-userpic\statics\jquery.modal.js')}}"></script>
<script src="{{asset('crop-userpic\script.js')}}"></script>
and this is the image : https://drive.google.com/open?id=1qgEmA9RlKy_eilZohCLajGmnVfqWSB9E
as you can see the image is in the box , but when i push submit , i get the validation error image field is required , like i don't have an image at all
please help me . i don't know what to do . and i love this Jcrop .

barcode with the value of barcode

$barcodeobj = new TCPDFBarcode($filesysid, 'C128');
$barcode = $barcodeobj->getBarcodeHTML(1, 20, 'black');
echo $barcode;
I am using the above code to generate a bar code of a specific value now it is generating ok. But I cant put the value of the bar code under the barcode
<div style="font-size:0;position:relative;width:35px;height:20px;">
<div style="background-color:black;width:2px;height:20px;position:absolute;left:0px;top:0px;"> </div>
<div style="background-color:black;width:1px;height:20px;position:absolute;left:3px;top:0px;"> </div>
<div style="background-color:black;width:1px;height:20px;position:absolute;left:6px;top:0px;"> </div>
<div style="background-color:black;width:2px;height:20px;position:absolute;left:11px;top:0px;"> </div>
<div style="background-color:black;width:2px;height:20px;position:absolute;left:15px;top:0px;"> </div>
<div style="background-color:black;width:2px;height:20px;position:absolute;left:18px;top:0px;"> </div>
<div style="background-color:black;width:2px;height:20px;position:absolute;left:22px;top:0px;"> </div>
<div style="background-color:black;width:3px;height:20px;position:absolute;left:27px;top:0px;"> </div>
<div style="background-color:black;width:1px;height:20px;position:absolute;left:31px;top:0px;"> </div>
<div style="background-color:black;width:2px;height:20px;position:absolute;left:33px;top:0px;"> </div>
<div style="background-color:black;width:0px;height:20px;position:absolute;left:35px;top:0px;"> </div>
<div style="background-color:black;width:0px;height:20px;position:absolute;left:35px;top:0px;"> </div>
</div>
Now What I want is under the code I also get the textual representation.
Update:
Example if I barcoded the numbers 1234 then under the barcode of 1234 I want to see 1234
Reason:
My reason is so that if the barcode is crample or the scan is failing the user can just type in the code and search.

"Could not find the file list container in the template" error

I am getting message "Could not find the file list container in the template" appearing in my Javascript debug console when using fine uploader.
Here is a jsfiddle example of the problem occurring.
http://jsfiddle.net/Lu82ba9L/1/
The code from the example is repeated here
<!-- using fine uploader 5.1.3 at http://keysymmetrics.com/jsfiddle/jquery.fine-uploader.js -->
$(document).ready(function () {
$("#fine-uploader").fineUploader({
debug: true,
template: 'qq-template-bootstrap',
request: {
endpoint: "/my-endpoint"
}
});
});
<script type="text/template" id="qq-template-bootstrap" class="qq-uploader-selector">
<div class="row">
<div class="col-sm-4" >
<div class="qq-upload-button-selector qq-upload-drop-area-selector drag-drop-area">
<div>Drag and drop files here or click to upload</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4" >
<div class="qq-upload-list-selector" >
<div class="panel panel-default" >
<div class="panel-body" >
<div class="qq-progress-bar-container-selector progress">
<div class="qq-progress-bar-selector progress-bar"></div>
</div>
<span class="qq-upload-spinner-selector qq-upload-spinner"></span>
<span class="qq-upload-file-selector qq-upload-file"></span>
<span class="qq-upload-size-selector qq-upload-size"></span>
<span class="qq-upload-status-text-selector qq-upload-status-text"></span>
<img class="qq-thumbnail-selector" qq-max-size="100" />
</div><!-- close panel-body -->
</div><!-- close panel -->
</div>
</div>
</div>
</script>
<h1>Fine Uploader Test</h1>
<div id="fine-uploader"></div>
Just for additional information that may be helpful, I have a working version here. http://jsfiddle.net/61motjed/2/ .In this version here I have moved the "div.qq-upload-list-selector" element to a different position in the DOM (however, this is not the DOM structure I want). It is also unclear to me why the first example fails but the 2nd example is working.
Your template is not valid. The template must contain a top-level element with a CSS class of "qq-uploader-selector". This element must contain all other elements in your template. Simply wrapping the contents of your template in an element with this class should fix your issue.

Move the file list to an alternate location in the DOM (fine-Uploader)

I need help with this.
I am using fineUploader 4.2.1 and trying to relocate file list to an alternate location in the DOM (our own element on the html page). Here is the code snippet that I have to achieve this.
-- Where I want file list created (manual upload with edit names)
<div class="qq-upload-list-container">
<ul class="qq-upload-list-selector qq-upload-list">
</ul>
</div>
-- My Current Template
< script type="text/template" id="qq-template" >
<div class="qq-uploader-selector qq-uploader">
<div class="qq-upload-drop-area-selector qq-upload-drop-area" qq-hide-dropzone>
<span>Drop files here to upload</span>
</div>
<div class="qq-upload-button-selector qq-upload-button qq-btn qq-btn-primary">
<span>Select Images (Max. 5)</span>
</div>
<span class="qq-drop-processing-selector qq-drop-processing">
<span>Processing dropped files...</span>
<span class="qq-drop-processing-spinner-selector qq-drop-processing-spinner"></span>
</span>
<ul class="qq-upload-list-selector qq-upload-list">
<li>
<div class="qq-progress-bar-container-selector">
<div class="qq-progress-bar-selector qq-progress-bar"></div>
</div>
<span class="qq-upload-spinner-selector qq-upload-spinner"></span>
<span class="qq-edit-filename-icon-selector qq-edit-filename-icon"></span>
<span class="qq-upload-file-selector qq-upload-file"></span>
<input class="qq-edit-filename-selector qq-edit-filename" tabindex="0" type="text">
<span class="qq-upload-size-selector qq-upload-size"></span>
<a class="qq-upload-cancel-selector qq-upload-cancel" href="#">Cancel</a>
<a class="qq-upload-retry-selector qq-upload-retry" href="#">Retry</a>
<a class="qq-upload-delete-selector qq-upload-delete" href="#">Delete</a>
<span class="qq-upload-status-text-selector qq-upload-status-text"></span>
</li>
</ul>
</div>
</ script >
-- My JavaScript Code Block.
<script>
$(document).ready(function(){
var manualuploader = $('#image-selector-fine-uploader').fineUploader({
listElement: "qq-upload-list-container",
//template: "qq-simple-thumbnails-template",
//template: "qq-template-manual-noedit",
template: "qq-template",
thumbnails: {
placeholders: {
waitingPath: $webroot + "img/waiting-generic.png",
notAvailablePath: $webroot + "img/not_available-generic.png"
}
},
request: {
endpoint: $uploadURL
},
validation: {
allowedExtensions: ['jpeg', 'jpg', 'gif', 'png']
},
editFilename: {
enabled: true
},
autoUpload: false
});
$('#upload-trigger-fine-uploader').click(function() {
manualuploader.fineUploader('uploadStoredFiles');
});
});
I am not sure what/where I am getting it wrong but the fineUploader is not creating file list under the DOM "qq-upload-list-container"
Any hints would be greatly appreciated.
-BC
It looks like there are a couple errors in this section of the documentation. The expected type of your listElement option should be an HTMLElement, not a String. Since you are using the jQuery plug-in wrapper, a jQuery object is also an acceptable value type.
So, your listElement option value should be $(".qq-upload-list-container");
I'll fix the issues with the documentation now.

xpath string to select a specific node with specific attribute

I have the follwoing HTML:
<div class=""postrow first"">
<h2 class=""title icon"">
This is the title
</h2>
<div class=""content"">
<div id=""post_message_1668079"">
<blockquote class=""postcontent restore "">
<div>Category</div>
line 1<br /> line2
</blockquote>
</div>
</div>
</div>
<div class=""postrow"">
<h2 class=""title icon"">
second title
</h2>
<div class=""content"">
<div id=""post_message_1668079"">
<blockquote class=""postcontent restore "">
<div>Category</div>
line 1<br /> line2
</blockquote>
</div>
</div>
</div>
What is the xpath string to select all DIVs with attribute is "postrow" or "postrow "
This answer assumes that for each "", you actually have " in your document.
There are a number of alternative XPaths available to you. Here are just two:
Using a conditional |:
//div[#class = "postrow"] | //div[#class = "postrow "]
Using starts-with:
//div[starts-with(#class, "postrow")]

Resources