File: D:/HostingSpaces/RImmers2/portal.photomenu.nl/wwwroot/views/restaurants/edit.html
<style>
.image-delete {
position: absolute;
font-size: 200%;
padding: 5px;
margin-left: -30px;
color: white;
background: rgba(1,1,1,0.5);
cursor: pointer;
}
.inline-group {
display: flex;
align-items: flex-start;
}
.inline-group label {
margin-right: 5px;
flex-basis: 125px;
}
</style>
<script>var adminFontColor = "#808080";</script>
<div class="row">
<div class="col-lg-12">
<h1 class="page-header"> @{if model.id == 'new'}New Restaurant@{else} Edit Restaurant "@{model.restaurant.Name}"@{fi} @{if repository.type == 'admin'}<span style="color:black;font-size:12px">@{model.id}</span> @{fi}</h1>
@{if model.error === true}
<div class="alert alert-danger">
@{model.errorMessage}
</div>
@{fi}
<form method="post" enctype='multipart/form-data'>
<input type="hidden" name="id" value="@{model.id}">
<!--
<div class="row col-md-12">
<label>General info:</label>
</div>
-->
<div class="form-group col-md-12">
<div class="form-group col-md-6 inline-group">
<label>Name *</label>
<input type="text" class="form-control" value="@{model.restaurant.Name}" maxlength=25 name="Name" />
</div>
<div class="form-group col-md-6 inline-group">
<label>Address *</label>
<input type="text" class="form-control" value="@{model.restaurant.Address}" maxlength=35 name="Address" />
</div>
<div class="form-group col-md-6 inline-group">
<label>Postcode *</label>
<input type="text" class="form-control" value="@{model.restaurant.Postcode}" maxlength=10 name="Postcode" />
</div>
<div class="form-group col-md-6 inline-group">
<label>City *</label>
<input type="text" class="form-control" value="@{model.restaurant.City}" maxlength=28 name="City" />
</div>
<div class="form-group col-md-6 inline-group">
<label>Country</label>
<select class="form-control col-md-6" name="Country">
<option value="Nederland">Nederland</option>
<option value="Belgium" @{if model.restaurant.Country == 'Belgium'}selected='selected'@{fi}>Belgium</option>
<option value="Spain" @{if model.restaurant.Country == 'Spain'}selected='selected'@{fi}>Spain</option>
</select>
</div>
<div class="form-group col-md-6 inline-group">
<label>Phone *</label>
<input type="text" class="form-control" value="@{model.restaurant.Phone}" maxlength=15 name="Phone" />
</div>
<div class="form-group col-md-6 inline-group">
<label title="Type of restaurant">Type *</label>
<input type="text" class="form-control" value="@{model.restaurant['Type of restaurant']}" maxlength=40 name="Type of restaurant" />
</div>
<div class="form-group col-md-6 inline-group">
<label title="Type of restaurant English">Type (Eng)</label>
<input type="text" class="form-control" value="@{model.restaurant['Type of restaurant ENG']}" maxlength=40 name="Type of restaurant ENG" />
</div>
<div class="form-group col-md-6 inline-group">
<label>E-mail *</label>
<input type="text" class="form-control" value="@{model.restaurant['E-mail']}" maxlength=40 name="E-mail" />
</div>
<div class="form-group col-md-6 inline-group">
<label>Website *</label>
<input type="text" class="form-control" value="@{model.restaurant.Website}" maxlength=40 name="Website" />
</div>
@{if repository.type == 'admin'}
<div class="form-group col-md-6 inline-group">
<label><a href="http://www.latlong.net/" target="_new">Latitude</a> *</label>
<input type="text" class="form-control" @{if repository.type !== 'admin'} disabled @{fi} value="@{model.restaurant.latitude}" name="latitude" />
</div>
<div class="form-group col-md-6 inline-group">
<label><a href="http://www.latlong.net/" target="_new">Longitude</a> *</label>
<input type="text" class="form-control" @{if repository.type !== 'admin'} disabled @{fi} value="@{model.restaurant.longitude}" name="longitude" />
</div>
@{fi}
<hr style="width: 100%; color: #f8f8f8; height: 1px; background-color:#f8f8f8;" />
<div class="form-group col-md-6 inline-group">
<label>Active</label>
<input style="align-self:center; margin:0;" type="checkbox" @{if model.restaurant.Inactive == false || model.id == 'new'}} checked @{fi} name="Inactive" />
<i><font color="blue"><i class="fa fa-info-circle" aria-hidden="true"></i> disabling this will not show the restaurant and the menu on the app</i></font>
</div>
@{if repository.type == 'admin'}
<div class="form-group col-md-6 inline-group">
<label style="flex-basis: 105px;">Credits *</label>
@{if model.id == 'new'}
<input @{if repository.type !=='admin'} disabled @{fi} type="text" style="width:150px" class="form-control" value="1000" name="Credits" />
@{else}
<input @{if repository.type !== 'admin'} disabled @{fi} type="text" style="width:150px" class="form-control" value="@{model.restaurant.Credits}" name="Credits" />
@{fi}
<i><font color="blue"><i class="fa fa-info-circle" aria-hidden="true"></i> less than 1 will not show the contact info on the app</i></font>
</div>
<div class="form-group col-md-6 inline-group">
<label><font color="console.log(adminFontColor);">Subscription</font></label>
<select class="form-control" style="width: 100px;" name="Subscription">
<option value="none-selected">-</option>
<option value="FREE" @{if model.restaurant.Subscription === 'FREE'}selected='selected'@{fi}>FREE</option>
<option value="TRIAL" @{if model.restaurant.Subscription === 'TRIAL'}selected='selected'@{fi}>TRIAL</option>
<option value="BASIC" @{if model.restaurant.Subscription === 'BASIC'}selected='selected'@{fi}>BASIC</option>
<option value="PREMIUM" @{if model.restaurant.Subscription === 'PREMIUM'}selected='selected'@{fi}>PREMIUM</option>
</select>
<b><font color="console.log(adminFontColor);">Date</font></b>
<input type="text" class="form-control" style="width:150px;" maxlength=10 value="@{model.restaurant['SubscriptionDate']}" name="SubscriptionDate" />
</div>
@{else}
<input type="hidden" name="Subscription" value="@{model.restaurant.Subscription}">
@{fi}
@{if model.id !== 'new'}
@{if repository.type == 'admin'}
<div class="form-group col-md-6 inline-group">
<label style="flex-basis: 105px;">Views Android *</i></label>
<input type="text" name="Number of times shown android" style="width:150px" class="form-control" @{if repository.type != 'admin'} disabled @{fi} value="@{model.restaurant['Number of times shown android']}" />
</div>
<div class="form-group col-md-6 inline-group">
<label style="width:250px;"><font color="console.log(adminFontColor);">Active dishes</font></label>
<input style="align-self:center; margin:0;" type="checkbox" @{if model.restaurant.hasActiveDishes==true} checked @{fi} name="hasActiveDishes" />
<i><font color="blue"><i class="fa fa-info-circle" aria-hidden="true"></i> enabling this will show button "bekijk menu"</i></font>
</div>
<div class="form-group col-md-6 inline-group">
<label style="flex-basis: 105px;">Views Apple *</i></label>
<input type="text" name="Number of times shown iOS" style="width:150px" class="form-control" @{if repository.type != 'admin'} disabled @{fi} value="@{model.restaurant['Number of times shown iOS']}" />
</div>
@{else if user.hasStatistics}
<div class="form-group col-md-6 inline-group">
@{if model.restaurant.hasActiveDishes}
<input type="hidden" name="hasActiveDishes" value="on">
@{fi}
</div>
<div class="form-group col-md-6 inline-group">
<label style="flex-basis: 105px;">Views Apple</i></label>
<input type="text" name="lbl_dummy_2" style="width:150px" class="form-control" @{if repository.type != 'admin'} disabled @{fi} value="@{model.restaurant['Number of times shown iOS']}" />
<label style="flex-basis: 105px;">Views Android</i></label>
<input type="text" name="lbl_dummy_1" style="width:150px" class="form-control" @{if repository.type != 'admin'} disabled @{fi} value="@{model.restaurant['Number of times shown android']}" />
<input type="hidden" name="Number of times shown android" value="@{model.restaurant['Number of times shown android']}" />
<input type="hidden" name="Number of times shown iOS" value="@{model.restaurant['Number of times shown iOS']}" />
</div>
<div class="form-group col-md-12 inline-group">
<label style="width:250px;">No share emails</label>
<input type="checkbox" @{if model.restaurant['Disable share emails']} checked @{fi} name="Disable share emails" />
<i><font color="blue"><i class="fa fa-info-circle" aria-hidden="true"></i> enabling this will sent all shares to restaurant e-mail!</i></font>
</div>
@{fi}
@{else if repository.type == 'admin'}
<div class="form-group col-md-6 inline-group">
<label style="flex-basis: 105px;">Views Android *</i></label>
<input type="text" name="Number of times shown android" style="width:150px" class="form-control" @{if repository.type !='admin' } disabled @{fi} value="1" />
</div>
<div class="form-group col-md-6 inline-group">
<label style="width:250px;"><font color="console.log(adminFontColor);">Active dishes</font></label>
<input style="align-self:center; margin:0;" type="checkbox" @{if model.restaurant.hasActiveDishes==true} checked @{fi} name="hasActiveDishes" />
<i><font color="blue"><i class="fa fa-info-circle" aria-hidden="true"></i> enabling this will show button "bekijk menu"</i></font>
</div>
<div class="form-group col-md-6 inline-group">
<label style="flex-basis: 105px;">Views Apple *</i></label>
<input type="text" name="Number of times shown iOS" style="width:150px" class="form-control" @{if repository.type !='admin' } disabled @{fi} value="1" />
</div>
<div class="form-group col-md-6 inline-group">
<label style="width:250px;">No share emails</label>
<input type="checkbox" checked name="Disable share emails" />
</div>
@{fi}
<hr style="width: 100%; color: #f8f8f8; height: 1px; background-color:#f8f8f8;" />
<!--
<div class="row col-md-12">
<label>Restaurant info:</label>
</div>
-->
<div class='form-group col-md-6'>
<label>Description *</label>
<textarea maxlength=400 class="form-control" name="Description" rows="6" style="resize: vertical;" >@{model.restaurant.Description}</textarea>
</div>
<div class='form-group col-md-6'>
<label>Description (Eng)</label>
<textarea class="form-control" maxlength=400 name="Description ENG" rows="6" style="resize: vertical;" >@{model.restaurant['Description ENG']}</textarea>
</div>
<div class="form-group col-md-3">
<label>Opening hours *</label>
<input type="text" class="form-control" maxlength=70 value="@{model.restaurant['Opening hours']}" name="Opening hours" />
</div>
<div class="form-group col-md-3">
<label>Opening hours (Eng)</label>
<input type="text" class="form-control" maxlength=70 value="@{model.restaurant['Opening hours ENG']}" name="Opening hours ENG" />
</div>
<div class="form-group col-md-3">
<label>Lunch start</label>
<div class="input-group bootstrap-timepicker timepicker">
<input type="text" name="Lunch start" value="@{model.restaurant['Lunch start']}" class="form-control input-small">
<span class="input-group-addon"><i class="glyphicon glyphicon-time"></i></span>
</div>
</div>
<div class="form-group col-md-3">
<label>Lunch finish</label>
<div class="input-group bootstrap-timepicker timepicker">
<input type="text" name="Lunch finish" value="@{model.restaurant['Lunch finish']}" class="form-control input-small">
<span class="input-group-addon"><i class="glyphicon glyphicon-time"></i></span>
</div>
</div>
<hr style="width: 100%; color: #f8f8f8; height: 1px; background-color:#f8f8f8;" />
<div class="form-group col-md-6">
<label>Opening hours per day</label>
<br/><br/>
<div class='row form-group'>
<div class='col-md-1'>
MON:
</div>
<div class='col-md-11'>
<input type="text" maxlength=20 style="width:200px" name="MON" class='form-control' value="@{model.restaurant?model.restaurant['Opening hours per day'][0]:''}" />
</div>
</div>
<div class='row form-group'>
<div class='col-md-1'>
TUE:
</div>
<div class='col-md-11'>
<input type="text" maxlength=20 style="width:200px" name="TUE" class='form-control' value="@{model.restaurant?model.restaurant['Opening hours per day'][1]:''}" />
</div>
</div>
<div class='row form-group'>
<div class='col-md-1'>
WED:
</div>
<div class='col-md-11'>
<input type="text" maxlength=20 style="width:200px" name="WED" class='form-control' value="@{model.restaurant?model.restaurant['Opening hours per day'][2]:''}" />
</div>
</div>
<div class='row form-group'>
<div class='col-md-1'>
THU:
</div>
<div class='col-md-11'>
<input type="text" maxlength=20 style="width:200px" name="THU" class='form-control' value="@{model.restaurant?model.restaurant['Opening hours per day'][3]:''}" />
</div>
</div>
<div class='row form-group'>
<div class='col-md-1'>
FRI:
</div>
<div class='col-md-11'>
<input type="text" maxlength=20 style="width:200px" name="FRI" class='form-control' value="@{model.restaurant?model.restaurant['Opening hours per day'][4]:''}" />
</div>
</div>
<div class='row form-group'>
<div class='col-md-1'>
SAT:
</div>
<div class='col-md-11'>
<input type="text" maxlength=20 style="width:200px" name="SAT" class='form-control' value="@{model.restaurant?model.restaurant['Opening hours per day'][5]:''}" />
</div>
</div>
<div class='row form-group'>
<div class='col-md-1'>
SUN:
</div>
<div class='col-md-11'>
<input type="text" maxlength=20 style="width:200px" name="SUN" class='form-control' value="@{model.restaurant?model.restaurant['Opening hours per day'][6]:''}" />
</div>
</div>
</div>
<div class="form-group col-md-6">
<label>Opening hours per day (Eng)</label>
<br/><br/>
<div class='row form-group'>
<div class='col-md-1'>
MON:
</div>
<div class='col-md-11'>
<input type="text" maxlength=20 style="width:200px" name="MON-ENG" class='form-control' value="@{model.restaurant['Opening hours per day ENG']?model.restaurant['Opening hours per day ENG'][0]:''}" />
</div>
</div>
<div class='row form-group'>
<div class='col-md-1'>
TUE:
</div>
<div class='col-md-11'>
<input type="text" maxlength=20 style="width:200px" name="TUE-ENG" class='form-control' value="@{model.restaurant['Opening hours per day ENG']?model.restaurant['Opening hours per day ENG'][1]:''}" />
</div>
</div>
<div class='row form-group'>
<div class='col-md-1'>
WED:
</div>
<div class='col-md-11'>
<input type="text" maxlength=20 style="width:200px" name="WED-ENG" class='form-control' value="@{model.restaurant['Opening hours per day ENG']?model.restaurant['Opening hours per day ENG'][2]:''}" />
</div>
</div>
<div class='row form-group'>
<div class='col-md-1'>
THU:
</div>
<div class='col-md-11'>
<input type="text" maxlength=20 style="width:200px" name="THU-ENG" class='form-control' value="@{model.restaurant['Opening hours per day ENG']?model.restaurant['Opening hours per day ENG'][3]:''}" />
</div>
</div>
<div class='row form-group'>
<div class='col-md-1'>
FRI:
</div>
<div class='col-md-11'>
<input type="text" maxlength=20 style="width:200px" name="FRI-ENG" class='form-control' value="@{model.restaurant['Opening hours per day ENG']?model.restaurant['Opening hours per day ENG'][4]:''}" />
</div>
</div>
<div class='row form-group'>
<div class='col-md-1'>
SAT:
</div>
<div class='col-md-11'>
<input type="text" maxlength=20 style="width:200px" name="SAT-ENG" class='form-control' value="@{model.restaurant['Opening hours per day ENG']?model.restaurant['Opening hours per day ENG'][5]:''}" />
</div>
</div>
<div class='row form-group'>
<div class='col-md-1'>
SUN:
</div>
<div class='col-md-11'>
<input type="text" maxlength=20 style="width:200px" name="SUN-ENG" class='form-control' value="@{model.restaurant['Opening hours per day ENG']?model.restaurant['Opening hours per day ENG'][6]:''}" />
</div>
</div>
</div>
<hr style="width: 100%; color: #f8f8f8; height: 1px; background-color:#f8f8f8;" />
<div class="form-group col-md-12">
<input style="align-self:center; margin:0;" type="checkbox" checked disabled/>
<label style="width:500px;">Hereby I give PhotoMenu permission to use my photos for commercial purposes</label>
</div>
<div class="form-group col-md-6">
<label>Thumbnail * </label>
<input type="file" accept=".jpg,.jpeg,.png,.gif,.JPG,.JPEG,.PNG,.GIF" name="thumbnail" onchange=thumbUploadPreview()>
<div style="font-style: italic;font-weight: 500;color:blue;">
<i><font color="blue"><i class="fa fa-info-circle" aria-hidden="true"></i> All images will be resized automatically</i></font>
</div>
<br/>
<img id="thumb-preview" src="@{model.restaurant.thumbnail}" style="max-height: 150px;"/>
</div>
<div class="form-group col-md-6">
<label>Images *</label>
<input type="file" accept=".jpg,.jpeg,.png,.gif,.JPG,.JPEG,.PNG,.GIF" name="images" multiple>
<div style="font-style: italic;font-weight: 500;color:blue;">
<i><font color="blue"><i class="fa fa-info-circle" aria-hidden="true"></i> It is possible to select multiple images by holding the control key</i></font>
</div>
<br/>
@{foreach img in model.restaurant.images}
<span>
<img src="@{img}" style="max-height: 150px; padding: 4px;"/>
<a href="javascript:void(0)"
onclick="if(confirm('Are you sure?')){document.location.href='/restaurants/edit/@{model.id}/delete-image/@{index}'}"
class="fa fa-close image-delete"></a>
</span>
@{end}
</div>
<div class="form-group col-md-12">
<button type="submit" onClick="this.form.submit(); this.disabled=true;" style="width:80px" class="btn btn-primary"><i class="fa fa-floppy-o" aria-hidden="true"></i> Save</button>
@{if model.dishID !== 'new' && repository.type == 'admin'}
<a class="btn btn-default" style="width:80px" href="javascript:void(0)" onclick="if (confirm('Are you sure you want to delete this Restaurant?')) {document.location.href = '/restaurants/delete/@{model.id}'}"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
@{fi}
<a href="/restaurants" style="width:80px" class="btn btn-default"><i class="fa fa-times" aria-hidden="true"></i> Cancel</a>
</div>
</form>
</div>
</div>
</div>
<script type="text/javascript">
function thumbUploadPreview() {
var preview = document.querySelector('#thumb-preview');
var file = document.querySelector('input[name=thumbnail]').files[0];
var reader = new FileReader();
reader.addEventListener("load", function () {
preview.src = reader.result;
}, false);
reader.readAsDataURL(file);
}
</script>