the model:
using CII.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace CII.Web.Models
{
public class POIlangData
{
public long POIId { get; set; }
public int CategoryId { get; set; }
public string WebsiteUrl { get; set; }
public string PhoneNumber { get; set; }
public string PhoneNumber_Spa { get; set; }
public string PhoneNumber_RoomServices { get; set; }
public string PhoneNumber_Concierge { get; set; }
public Nullable<decimal> Latitude { get; set; }
public Nullable<decimal> Longitude { get; set; }
public Nullable<System.Guid> LogoFileId { get; set; }
public System.Data.Entity.Spatial.DbGeography Location { get; set; }
public Nullable<System.DateTime> FromDate { get; set; }
public Nullable<System.DateTime> ToDate { get; set; }
public int CityId { get; set; }
public Nullable<long> ChainId { get; set; }
public bool Recommended { get; set; }
public Nullable<System.Guid> ImageFileId { get; set; }
public Nullable<int> HotelId { get; set; }
public Nullable<int> OpenDay1 { get; set; }
public Nullable<int> EndDay1 { get; set; }
public Nullable<int> OpenDay2 { get; set; }
public Nullable<int> EndDay2 { get; set; }
public Nullable<System.TimeSpan> OpenTime1 { get; set; }
public Nullable<System.TimeSpan> CloseTime1 { get; set; }
public Nullable<System.TimeSpan> OpenTime2 { get; set; }
public string CloseTime2 { get; set; }
public virtual Category Category { get; set; }
public virtual File File { get; set; }
public virtual ICollection<Intro> Introes { get; set; }
public virtual ICollection<POIs_Lang> POIs_Lang { get; set; }
public virtual ICollection<Tag> Tags { get; set; }
public virtual ICollection<Tours_POIs> Tours_POIs { get; set; }
public virtual ICollection<Users_POIs_Tours> Users_POIs_Tours { get; set; }
public virtual City City { get; set; }
public virtual Chain Chain { get; set; }
public virtual File File1 { get; set; }
public virtual ICollection<Activity> Activities { get; set; }
public virtual ICollection<POIsImage> POIsImages { get; set; }
public int LanguageId { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public string Description { get; set; }
public Nullable<System.Guid> AttachementId { get; set; }
public Nullable<System.Guid> CouponAttachementId { get; set; }
public virtual Language Language { get; set; }
public virtual POIs POIs { get; set; }
public POIlangData()
{
POIId = 0;
}
public POIlangData(POIs pois)
{
POIId = pois.POIId;
CategoryId = pois.CategoryId;
WebsiteUrl = pois.WebsiteUrl;
PhoneNumber = pois.PhoneNumber;
PhoneNumber_Spa = pois.PhoneNumber_Spa;
PhoneNumber_RoomServices = pois.PhoneNumber_RoomServices;
PhoneNumber_Concierge = pois.PhoneNumber_Concierge;
Latitude = pois.Latitude;
Longitude = pois.Longitude;
LogoFileId = pois.LogoFileId;
Location = pois.Location;
FromDate = pois.FromDate;
ToDate = pois.ToDate;
CityId = pois.CityId;
ChainId = pois.ChainId;
Recommended = pois.Recommended;
ImageFileId = pois.ImageFileId;
HotelId = pois.HotelId;
OpenDay1 = pois.OpenDay1;
EndDay1 = pois.EndDay1;
OpenDay2 = pois.OpenDay2;
EndDay2 = pois.EndDay2;
OpenTime1 = pois.OpenTime1;
CloseTime1 = pois.CloseTime1;
OpenTime2 = pois.OpenTime2;
CloseTime2 = pois.CloseTime2;
Category = pois.Category;
File = pois.File;
Introes = pois.Introes;
POIs_Lang = pois.POIs_Lang;
Tags = pois.Tags;
Tours_POIs = pois.Tours_POIs;
Users_POIs_Tours = pois.Users_POIs_Tours;
City = pois.City;
Chain = pois.Chain;
File1 = pois.File1;
Activities = pois.Activities;
POIsImages = pois.POIsImages;
}
public POIlangData(POIs pois, POIs_Lang pois_lang)
{
POIId = pois.POIId;
CategoryId = pois.CategoryId;
WebsiteUrl = pois.WebsiteUrl;
PhoneNumber = pois.PhoneNumber;
PhoneNumber_Spa = pois.PhoneNumber_Spa;
PhoneNumber_RoomServices = pois.PhoneNumber_RoomServices;
PhoneNumber_Concierge = pois.PhoneNumber_Concierge;
Latitude = pois.Latitude;
Longitude = pois.Longitude;
LogoFileId = pois.LogoFileId;
Location = pois.Location;
FromDate = pois.FromDate;
ToDate = pois.ToDate;
CityId = pois.CityId;
ChainId = pois.ChainId;
Recommended = pois.Recommended;
ImageFileId = pois.ImageFileId;
HotelId = pois.HotelId;
OpenDay1 = pois.OpenDay1;
EndDay1 = pois.EndDay1;
OpenDay2 = pois.OpenDay2;
EndDay2 = pois.EndDay2;
OpenTime1 = pois.OpenTime1;
CloseTime1 = pois.CloseTime1;
OpenTime2 = pois.OpenTime2;
CloseTime2 = pois.CloseTime2;
Category = pois.Category;
File = pois.File;
Introes = pois.Introes;
POIs_Lang = pois.POIs_Lang;
Tags = pois.Tags;
Tours_POIs = pois.Tours_POIs;
Users_POIs_Tours = pois.Users_POIs_Tours;
City = pois.City;
Chain = pois.Chain;
File1 = pois.File1;
Activities = pois.Activities;
POIsImages = pois.POIsImages;
LanguageId = pois_lang.LanguageId;
Name = pois_lang.Name;
Address = pois_lang.Address;
Description = pois_lang.Description;
AttachementId = pois_lang.AttachementId;
CouponAttachementId = pois_lang.CouponAttachementId;
Language = pois_lang.Language;
POIs = pois_lang.POIs;
}
}
}
the controller:
public ActionResult Edit([Bind(Include = "POIId,CategoryId,WebsiteUrl,PhoneNumber,PhoneNumber_Spa,PhoneNumber_RoomServices,PhoneNumber_Concierge,Latitude,Longitude,LogoFileId,Location,FromDate,ToDate,CityId,ChainId,Recommended,ImageFileId,HotelId,OpenDay1,EndDay1,OpenDay2,EndDay2,OpenTime1,CloseTime1,OpenTime2,CloseTime2")] POIs pois, ICollection<POIs_Lang> poilang, HttpPostedFileBase[] imgfiles, string[] imageids, int[] keep,POIs_Lang pois_lang)
{
if (ModelState.IsValid)
{
if (pois.POIId == 0)
db.POIs.Add(pois);
else
db.Entry(pois).State = EntityState.Modified;
POIsImage img;
if (keep!=null)
{
Guid[] removedimgs = new Guid[keep.Count()];
int r = 0;
for (var x = 0; x < keep.Length; x++)
{
if (keep[x]==0)
{
long id;
if (long.TryParse(imageids[x],out id))
{
img = db.POIsImages.Find(id);
if (img!=null)
{
db.POIsImages.Remove(img);
removedimgs[r++] = img.FileId;
db.SaveChanges();
}
}
}
}
r = 0;
for (var x = 0; x < keep.Length; x++)
{
if (keep[x] == 1)
if (imgfiles.First() != null)
{
var file = imgfiles.Where(p => p.FileName == imageids[x]).FirstOrDefault();
if (file != null && file.ContentLength > 0)
{
img = new POIsImage();
img.POIId = pois.POIId;
img.DisplayOrder = x;
img.File = Domain.MediaServices.Save(removedimgs[r++], file, db);
db.POIsImages.Add(img);
db.SaveChanges();
}
}
}
}
foreach (var cl in poilang)
{
bool exists = db.POIs_Lang.Where(d => d.POIId == pois.POIId && d.LanguageId == cl.LanguageId).Any();
cl.POIId = pois.POIId;
if (!exists)
{
if (cl.Name != null)
db.POIs_Lang.Add(cl);
}
else
db.Entry(cl).State = EntityState.Modified;
}
db.SaveChanges();
foreach(var pl in poilang)
{
bool exists_lang = db.POIs_Lang.Where(d => d.POIId == pois.POIId && d.LanguageId == pois_lang.LanguageId).Any();
pl.POIId=pois.POIId;
if (!exists_lang)
if(pl.Name != null)
db.POIs_Lang.Add(pl);
else
db.Entry(pl).State = EntityState.Modified;
if (pois_lang.Name == null)
pois_lang.Name = "";
if (pois_lang.Address == null)
pois_lang.Address = "";
if (Request.Files["attachment"] != null && Request.Files["attachment"].ContentLength > 0)
pois_lang.File = Domain.MediaServices.Save(pois_lang.AttachementId, Request.Files["attachment"], db);
if (Request.Files["coupon"] != null && Request.Files["coupon"].ContentLength > 0)
pois_lang.File1 = Domain.MediaServices.Save(pois_lang.CouponAttachementId, Request.Files["coupon"], db);
}
db.SaveChanges();
pois.Location = LocationUtils.CreateLocation(pois.Latitude, pois.Longitude);
return RedirectToAction("Index", new { catid = pois.CategoryId });
}
ViewBag.CategoryId = new SelectList(db.Categories.Select(c => new { CategoryId = c.CategoryId, Name = c.Categories_lang.FirstOrDefault().CategoryName }), "CategoryId", "Name", pois.CategoryId);
ViewBag.CityId = new SelectList(db.Cities.Select(c => new { CityId = c.CityId, Name = c.Cities_lang.FirstOrDefault().CityName }), "CityId", "Name", pois.CityId);
ViewData["languages"] = db.Languages.OrderBy(l => l.LanguageId).ToList();
POIlangData poi_lang_data = new POIlangData(pois);
return View(poi_lang_data);
}
the view:
@model CII.Web.Models.POIlangData
@{
ViewBag.Title = "Edit POI";
int langId = ViewBag.LangId;
long POIId = ViewBag.POIId;
@Html.Hidden("LanguageId", langId)
@*@Html.Hidden("langId", langId)*@
List<CII.Domain.Language> langlist = (List<CII.Domain.Language>)ViewData["languages"];
}
<script src="~/Scripts/carousel.js/lightbox.js"></script>
<script type="text/javascript">
function readURL(input) {
$('.newlink').remove();
var count = $('#NumberofImages').val();
if (input.files && input.files[0]) {
for (var i = 0; i < input.files.length; i++) {
var reader = new FileReader();
$('#images').append('<input type="hidden" name="imageids[' + count + ']" value="' + input.files[i].name + '" />');
$('#images').append('<input type="hidden" name="keep[' + count + ']" value="1" data-imageid="' + count + '"/>');
$('#images').append("<a id='link' class='newlink darken' ></a>");
reader.onload = function (e) {
var count = $('#NumberofImages').val();
$('#link').append("<img id='image' class='img-rounded' src='" + e.target.result + "' data-imageid='" + count + "' width='80' height='80'/>");
$('#link').append('<span class="hoverText" data-imageid="' + count + '">Remove</span>');
$('#link').attr('id', 'link' + count);
$('#NumberofImages').val(++count);
};
reader.readAsDataURL(input.files[i]);
}
$('#noimage').remove();
}
}
function ImageClick(val) {
var clicked = 0;
$('input[data-imageid]').each(function () {
if ($(this).attr('data-imageid') == val) {
clicked = $(this).val();
if (clicked == 1)
$(this).val(0);
else
$(this).val(1);
clicked = $(this).val();
}
});
if (clicked == 0) {
$('img[data-imageid]').each(function () {
if ($(this).attr('data-imageid') == val) {
$(this).css("opacity", "0.2");
$(this).unbind('mouseenter mouseleave');
}
});
$('span[data-imageid]').each(function () {
if ($(this).attr('data-imageid') == val)
$(this).text("Add");
});
}
else {
$('img[data-imageid]').each(function () {
if ($(this).attr('data-imageid') == val) {
$(this).hover(function () { $(this).css("opacity", "0.4"); },
function () { $(this).css("opacity", "1"); });
}
});
$('span[data-imageid]').each(function () {
if ($(this).attr('data-imageid') == val)
$(this).text("Remove");
});
}
}
function setcategory() {
var val = $('#CategoryId').val();
$('[data-category]').each(function () {
if ($(this).attr('data-category').indexOf('|' + val + '|') > -1)
$(this).show();
else
$(this).hide();
});
}
function setlanguage() {
var val = $('#LanguageId').val();
$('[data-Language]').each(function () {
if ($(this).attr('data-Language').indexOf('|' + val + '|') > -1)
if ($(this).prop("tagName") == "B")
$(this).css("color", "#6700ab");
else
$(this).show();
else
if ($(this).prop("tagName") == "B")
$(this).css("color", "#0094ff");
else
$(this).hide();
});
}
function changelanguage(lang) {
$('#LanguageId').val(lang);
setlanguage();
}
$(document).ready(function () {
setlanguage();
setcategory();
});
</script>
<style>
a.darken:hover img {
opacity: 0.4;
}
a.darken:hover {
display: inline-block;
background: black;
padding: 0;
position: relative;
}
a.darken span {
position: absolute;
top: 10px;
left: 10px;
color: rgba(255, 255, 255, 0);
}
a.darken:hover span {
color: #ff0000;
font-size: 18px;
}
</style>
@*זה לא היה בהערה*@
@*@if (Model.ChainId == 0)
{
<h2>
Create New Chain
</h2>}
else
{
<h2>Edit</h2>
}
<h2>POI Edit</h2>*@
@using (Html.BeginForm("Edit", "POI", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
<input type="hidden" value=@Model.CategoryId id="CategoryId" />
<input type="hidden" value=@Model.POIs_Lang id="langId" />
<div class="form-horizontal">
<h4>POIs</h4>
<hr />
<input hidden="hidden" id="id" value=@Model.POIId />
@Html.ValidationSummary(true)
@Html.HiddenFor(model => model.POIId)
@Html.HiddenFor(model => model.LogoFileId)
@Html.HiddenFor(model => model.ImageFileId)
<div class="row">
@*ממומלץ*@
<div class="form-group col-md-8">
@if (Model.ChainId == null)
{
@Html.LabelFor(model => model.Recommended, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Recommended)
@Html.ValidationMessageFor(model => model.Recommended)
</div>
}
else
{
@Html.HiddenFor(model => model.Recommended)
}
</div>
</div>
@*myCarousel*@
<div class="row">
<div class="col-xs-10">
@*לוגו ותמונה*@
<div class="row">
<div class="col-md-2">
@if (Model != null && Model.LogoFileId.HasValue)
{
<div class="form-group">
<label class="control-label col-md-2">@*POI logo*@</label>
<a class="col-md-10" href="@Url.RouteUrl("Media", new {id=Model.LogoFileId})" target="_blank"><img src="@Url.RouteUrl("Media", new {id=Model.LogoFileId})" width="100" height="100" /></a>
</div>
}
@if (Model != null && Model.ImageFileId.HasValue)
{
<div class="form-group">
<label class="control-label col-md-2">@*POI image*@</label>
<a class="col-md-10" href="@Url.RouteUrl("Media", new { id = Model.ImageFileId })" target="_blank"><img src="@Url.RouteUrl("Media", new { id = Model.ImageFileId})" width="100" height="100" /></a>
</div>
}
</div>
@*תמונה*@
<div class="col-xs-3">
<div class="form-group">
<div class="col-md-10">
<br />
<label class="control-label">Upload a new POI logo</label>
<input type="file" id="logo" class="form-control" name="logo" />
@if (Model != null && Model.LogoFileId.HasValue)
{
<p class="help-block">The old image will be replaced !</p>
}
</div>
</div>
@* <div class="form-group">
<div class="col-md-10">
<label class="control-label">Upload a new POI image</label>
<input type="file" id="image" class="form-control" name="image" />
@if (Model != null && Model.ImageFileId.HasValue)
{
<p class="help-block">The old image will be replaced !</p>
}
</div>
</div>*@
<div class="form-group">
<div class="col-md-10">
<br />
<label class="control-label">Upload new Images</label>
<input type="file" id="imgfiles" class="form-control" name="imgfiles" multiple onchange="readURL(this);" />
</div>
</div>
</div>
<div class="col-xs-3">
@*עיר*@
<div class="form-group">
@Html.LabelFor(model => model.CityId, "City", new { @class = "control-label col-md-3" })
<div class="col-md-10">
@Html.DropDownListFor(model => model.CityId, ViewBag.CityId.Items as IEnumerable<SelectListItem>, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.CityId)
</div>
</div>
@*טלפון*@
<div class="form-group">
@Html.LabelFor(model => model.PhoneNumber, new { @class = "control-label col-md-4" })
<div class="col-md-10">
@Html.TextBoxFor(model => model.PhoneNumber, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.PhoneNumber)
</div>
</div>
@*נקודת X,Y*@
<div class="form-group">
@Html.LabelFor(model => model.Latitude, new { @class = "control-label col-md-3" })
<div class="col-md-10">
@Html.TextBoxFor(model => model.Latitude, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Latitude)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Longitude, new { @class = "control-label col-md-3" })
<div class="col-md-10">
@Html.TextBoxFor(model => model.Longitude, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Longitude)
</div>
</div>
</div>
<div class="col-md-3">
@*טלפונים של הבית מלון*@
<div class="form-group" data-category="|5|">
@Html.LabelFor(model => model.PhoneNumber_Spa, new { @class = "control-label col-md-4" })
<div class="col-md-10">
@Html.TextBoxFor(model => model.PhoneNumber_Spa, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.PhoneNumber_Spa)
</div>
</div>
<div class="form-group" data-category="|5|">
@Html.LabelFor(model => model.PhoneNumber_RoomServices, new { @class = "control-label col-md-4" })
<div class="col-md-10">
@Html.TextBoxFor(model => model.PhoneNumber_RoomServices, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.PhoneNumber_RoomServices)
</div>
</div>
<div class="form-group" data-category="|5|">
@Html.LabelFor(model => model.PhoneNumber_Concierge, new { @class = "control-label col-md-4" })
<div class="col-md-10">
@Html.TextBoxFor(model => model.PhoneNumber_Concierge, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.PhoneNumber_Concierge)
</div>
</div>
<div class="form-group" data-category="|5|">
@Html.LabelFor(model => model.HotelId, new { @class = "control-label col-md-4" })
<div class="col-md-10">
@Html.TextBoxFor(model => model.HotelId, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.HotelId)
</div>
</div>
</div>
<div class="col-md-4">
@*תמונות*@
<div class="col-md-5">
<label class="control-label">City background Images</label>
<div id="images">
@{
int x = 0;
foreach (var img in Model.POIsImages)
{
@Html.Hidden("imageids[" + x + "]", img.ImageId);
<input type="hidden" name="keep[@x]" value="1" data-imageid="@x" />
<a class="darken" >
<img id="image" class="img-rounded" data-imageid="@x" src="@Url.RouteUrl("Media", new { id = img.FileId })" width="80" height="80" />
<span class="hoverText" data-imageid="@x">Remove</span>
</a>
//x++;
}
@Html.Hidden("NumberofImages", x);
}
</div>
@if (Model.POIsImages.Count == 0)
{
<div id="noimage" class="text-center h3"><br /><br />No Images Uploaded</div>
}
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="row">
<label class="col-md-2">Day: </label>
<div class="form-group col-md-4">
<div>
@Html.TextBoxFor(model => model.OpenDay1, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.OpenDay1)
</div>
</div>
<label class="col-sm-1">-</label>
<div class="form-group col-md-4">
<div>
@Html.TextBoxFor(model => model.EndDay1, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.EndDay1)
</div>
</div>
</div>
<div class="row">
<label class="col-md-2">Day: </label>
<div class="form-group col-md-4">
<div>
@Html.TextBoxFor(model => model.OpenDay2, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.OpenDay2)
</div>
</div>
<label class="col-sm-1">-</label>
<div class="form-group col-md-4">
<div>
@Html.TextBoxFor(model => model.EndDay2, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.EndDay2)
</div>
</div>
</div>
</div>
<div class="col-md-5">
<div class="row">
<label class="col-md-2">Time: </label>
<div class="form-group col-md-4">
<div>
@Html.TextBoxFor(model => model.OpenTime1, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.OpenTime1)
</div>
</div>
<label class="col-sm-1">--</label>
<div class="form-group col-md-4">
<div>
@Html.TextBoxFor(model => model.CloseTime1, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.CloseTime1)
</div>
</div>
</div>
<div class="row">
<label class="col-md-2">Time: </label>
<div class="form-group col-md-4">
<div>
@Html.TextBoxFor(model => model.OpenTime2, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.OpenTime2)
</div>
</div>
<label class="col-sm-1">--</label>
<div class="form-group col-md-4">
<div>
@Html.TextBoxFor(model => model.CloseTime2, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.CloseTime2)
</div>
</div>
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" />
</div>
</div>
</div>
</div>
</div>
</div>
@*קטגוריה*@
<div class="form-group" hidden="hidden">
@Html.LabelFor(model => model.CategoryId, "Category", new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.DropDownListFor(model => model.CategoryId, ViewBag.CategoryId.Items as IEnumerable<SelectListItem>, new { onchange = "setcategory()", @class = "form-control" })
@Html.ValidationMessageFor(model => model.CategoryId)
</div>
</div>
@*תג
<div class="form-group">
@Html.LabelFor(model => model.Tags, new { @class = "control-label col-md-2" })
<div class="col-md-10">
<select data-placeholder="Select some tags" id="tagsList" name="tagsList" multiple="multiple" class="chosen form-control">
@foreach (var item in ViewData["tagslist"] as List<CII.Domain.Tags_Lang>)
{
<option value="@item.TagId" selected="@Model.Tags.Select(s=>s.TagId).Contains(item.TagId)">@item.Text</option>
}
</select>
</div>
</div>
*@
</div>
@*<input name="pois_lang" value="@Model.POIs_Lang" type="hidden" />*@
<div class="container" style="tab-size:inherit">
<ul class="nav nav-tabs">
@for (int i = 0; i < langlist.Count; i++)
{
int xx = 0;
string cssClass = "item active";
@Html.Hidden("pois_lang[" + xx + "]", langlist[i].LanguageId);
<li class="@cssClass">
@{
var plang = Model.POIs_Lang.FirstOrDefault(p => p.LanguageId == langlist[i].LanguageId);
if (plang != null)
{
<a >^__b data-language="|@langlist[i].LanguageId|"__^@langlist[i].Title</a>
}
else
{
<a >^__b data-language="|@langlist[i].LanguageId|"__^@langlist[i].Title</a>
}
}
</li>
cssClass = "item";
xx++;
}
</ul>
</div>
<div>
@for (int i = 0; i < langlist.Count; i++)
{
<table style="width:100%;">
<tr>
<td>
@{
var plang = Model.POIs_Lang.FirstOrDefault(p => p.LanguageId == langlist[i].LanguageId);
@Html.Hidden("poilang[" + i + "].POIId", Model.POIId)
@Html.Hidden("poilang[" + i + "].LanguageId", langlist[i].LanguageId)
@*שם*@
<div class="form-group" data-language="|@langlist[i].LanguageId|">
@Html.Label("Name", new { @class = "control-label col-md-3" })
<div class="col-md-7">
@Html.TextBox("poilang[" + i + "].Name", plang != null ? plang.Name : "", new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.POIs_Lang.FirstOrDefault(p => p.LanguageId == langlist[i].LanguageId).Name)
</div>
</div>
@*כתובת*@
<div class="form-group" data-language="|@langlist[i].LanguageId|">
@Html.Label("Address", new { @class = "control-label col-md-3" })
<div class="col-md-7">
@Html.TextBox("poilang[" + i + "].Address", plang != null ? plang.Address : "", new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Address)
</div>
</div>
@*תיאור*@
<div class="form-group" data-language="|@langlist[i].LanguageId|">
@Html.Label("Description", new { @class = "control-label col-md-3" })
<div class="col-md-7">
@Html.TextArea("chainlang[" + i + "].Description", plang != null ? plang.Description : "", new { @class = "form-control", rows = "15" })
@Html.ValidationMessageFor(model => model.POIs_Lang.FirstOrDefault(p => p.LanguageId == langlist[i].LanguageId).Description)
</div>
</div>
}
</td>
<td>
@if (Model != null && Model.AttachementId.HasValue)
{
<div class="form-group" data-language="|@langlist[i].LanguageId|">
<label class="control-label col-md-3">Attachment</label>
<a class="col-md-10" href="@Url.RouteUrl("Media", new {id=Model.AttachementId})" target="_blank">View Attachment</a>
<a class="col-md-10" href="#" >Delete Attachment</a>
</div>
}
<div class="form-group" data-language="|@langlist[i].LanguageId|">
<label class="control-label col-md-10">Upload a new Attachment </label>
<div class="col-md-8">
<input type="file" id="attachment" class="form-control" name="attachment" />
@if (Model != null && Model.AttachementId.HasValue)
{
<p class="help-block">The old attachment will be replaced !</p>
}
</div>
</div>
@if (Model != null && Model.CouponAttachementId.HasValue)
{
<div class="form-group" data-language="|@langlist[i].LanguageId|">
<label class="control-label col-md-10">Coupon</label>
<a class="col-md-10" href="@Url.RouteUrl("Media", new {id=Model.CouponAttachementId})" target="_blank">View Coupon</a>
<a class="col-md-10" href="#" >Delete Coupon</a>
</div>
}
<div class="form-group" data-language="|@langlist[i].LanguageId|">
<label class="control-label col-md-10">Upload a new Coupon </label>
<div class="col-md-8">
<input type="file" id="coupon" class="form-control" name="coupon" />
@if (Model != null && Model.CouponAttachementId.HasValue)
{
<p class="help-block">The old coupon will be replaced !</p>
}
</div>
</div>
</td>
</tr>
</table>
}
</div>
}
@*כרטסת נפתחת*@
@*<br />
<br />
<div class="container" style="tab-size:inherit">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#menu2" >English</a></li>
<li><a data-toggle="tab" href="#menu2 " >Hebrew</a></li>
<li><a data-toggle="tab" href="#menu2" >French</a></li>
<li><a data-toggle="tab" href="#menu3" >Russian</a></li>
<li><a data-toggle="tab" href="#menu3" >Spanish</a></li>
<li><a data-toggle="tab" href="#menu1" >German</a></li>
<li><a data-toggle="tab" href="#menu2" >Italian</a></li>
<li><a data-toggle="tab" href="#menu3" >Dutch</a></li>
<li><a data-toggle="tab" href="#menu3" >Chinese</a></li>
<li><a data-toggle="tab" href="#menu1" >Japanese</a></li>
<li><a data-toggle="tab" href="#menu2" >Arabic</a></li>
</ul>
</div>
}
<div id="lang"></div>
<script type="text/javascript">
function toEdidLang(langId) {
debugger;
var id = $("#id").val();
var target = "/POI/EditLang/?id=" + id + "&langId=" + langId + "&POIId=" + POIId
$.ajax({
url: target,
type: "GET",
async: true,
success: function (result) {
$("#lang").html(result);
},
})
}
</script>*@