v1.2.6.3
This commit is contained in:
@@ -486,7 +486,7 @@
|
||||
<data name="label.position" xml:space="preserve">
|
||||
<value>Position</value>
|
||||
</data>
|
||||
<data name="label.postalCode" xml:space="preserve">
|
||||
<data name="label.postal.code" xml:space="preserve">
|
||||
<value>Postal code</value>
|
||||
</data>
|
||||
<data name="label.previous" xml:space="preserve">
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
data.ContactMethods.Add(new AjaxResponse_Data.ContactMethodData() { Method = method.ToString(), MethodCaption = Localiser.GetContactMethodCaption(method), Value = contactData.GetContactMethodValue(method) });
|
||||
}
|
||||
// Address.
|
||||
if (address != null)
|
||||
if (address != null && !address.IsStatusDeleted)
|
||||
{
|
||||
data.Address = new AjaxResponse_Data.AddressData();
|
||||
data.Address.Id = model.EncryptId(address.Id);
|
||||
@@ -384,7 +384,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
organisationAddress = ItemDataMgr.CreateItemAddress(organisation.GetItemId(), SaxItemAddress.DefaultOrganisationAddressType);
|
||||
disposableItems.Add(organisationAddress);
|
||||
}
|
||||
else
|
||||
else if (!organisationAddress.IsStatusDeleted)
|
||||
{
|
||||
SaLogger.Warn(fn + " Organisation Address Id not supplied but no address found for Organisation. Id: " + organisationAddress.Id + ". " + GetLogSuffix());
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
@@ -450,51 +450,71 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
|
||||
// Store address.
|
||||
if (model.Organisation.Address.Line1 != null)
|
||||
organisationAddress.Line1 = model.Organisation.Address.Line1;
|
||||
if (model.Organisation.Address.Line2 != null)
|
||||
organisationAddress.Line2 = model.Organisation.Address.Line2;
|
||||
if (model.Organisation.Address.Line3 != null)
|
||||
organisationAddress.Line3 = model.Organisation.Address.Line3;
|
||||
if (model.Organisation.Address.Town != null)
|
||||
organisationAddress.Town = model.Organisation.Address.Town;
|
||||
if (regionProvince != null)
|
||||
if (model.Organisation.Address.IsSpecified())
|
||||
{
|
||||
organisationAddress.Province = regionProvince.Name;
|
||||
organisationAddress.RegionIdProvince = regionProvince.Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (model.Organisation.Address.Province != null)
|
||||
organisationAddress.Province = model.Organisation.Address.Province;
|
||||
}
|
||||
if (regionCountry != null)
|
||||
{
|
||||
organisationAddress.Country = regionCountry.Name;
|
||||
organisationAddress.RegionIdCountry = regionCountry.Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (model.Organisation.Address.Country != null)
|
||||
organisationAddress.Country = model.Organisation.Address.Country;
|
||||
}
|
||||
organisationAddress.PostalCode = model.Organisation.Address.PostalCode;
|
||||
if (!SysId.IsValid(organisationAddress.Id))
|
||||
{
|
||||
// Create new address.
|
||||
if (!ItemDataMgr.InsertItemAddress(organisationAddress, DbUpdateInfo))
|
||||
// The form includes address fields.
|
||||
if (model.Organisation.Address.IsPopulated())
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert organisation address - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
// At least one address field has been populated.
|
||||
if (model.Organisation.Address.Line1 != null)
|
||||
organisationAddress.Line1 = model.Organisation.Address.Line1;
|
||||
if (model.Organisation.Address.Line2 != null)
|
||||
organisationAddress.Line2 = model.Organisation.Address.Line2;
|
||||
if (model.Organisation.Address.Line3 != null)
|
||||
organisationAddress.Line3 = model.Organisation.Address.Line3;
|
||||
if (model.Organisation.Address.Town != null)
|
||||
organisationAddress.Town = model.Organisation.Address.Town;
|
||||
if (regionProvince != null)
|
||||
{
|
||||
organisationAddress.Province = regionProvince.Name;
|
||||
organisationAddress.RegionIdProvince = regionProvince.Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (model.Organisation.Address.Province != null)
|
||||
organisationAddress.Province = model.Organisation.Address.Province;
|
||||
}
|
||||
if (regionCountry != null)
|
||||
{
|
||||
organisationAddress.Country = regionCountry.Name;
|
||||
organisationAddress.RegionIdCountry = regionCountry.Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (model.Organisation.Address.Country != null)
|
||||
organisationAddress.Country = model.Organisation.Address.Country;
|
||||
}
|
||||
organisationAddress.PostalCode = model.Organisation.Address.PostalCode;
|
||||
organisationAddress.Status = SaxItemAddress.DefaultStatus;
|
||||
|
||||
// Store address.
|
||||
if (!SysId.IsValid(organisationAddress.Id))
|
||||
{
|
||||
// Create new address.
|
||||
if (!ItemDataMgr.InsertItemAddress(organisationAddress, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert organisation address - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update existing address.
|
||||
if (!ItemDataMgr.UpdateItemAddress(organisationAddress, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update organisation address - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update existing address.
|
||||
if (!ItemDataMgr.UpdateItemAddress(organisationAddress, DbUpdateInfo))
|
||||
else
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update organisation address - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
// Address not specified - delete it.
|
||||
if (!ItemDataMgr.DeleteItemAddress(organisationAddress, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to delete organisation address - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,13 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
/// <summary>Have any address values been populated on the form.</summary>
|
||||
public bool IsPopulated()
|
||||
{
|
||||
if (SysId.IsValid(Id.ToSysId()) || !StringUtil.IsEmpty(Line1) || !StringUtil.IsEmpty(Town) || !StringUtil.IsEmpty(Province) || !StringUtil.IsEmpty(Country) || !StringUtil.IsEmpty(PostalCode))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validation.
|
||||
@@ -58,6 +65,8 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
// Address.
|
||||
public bool ValidateAddressData(SaxController_Base.AjaxResponse_Data responseData)
|
||||
{
|
||||
// Are any properties populated.
|
||||
bool populated = IsPopulated();
|
||||
|
||||
// Address Line 1 - optional.
|
||||
if (Line1 != null)
|
||||
@@ -89,11 +98,11 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
}
|
||||
}
|
||||
|
||||
// Address Town - mandatory.
|
||||
// Address Town - mandatory if any value populated.
|
||||
if (Town != null)
|
||||
{
|
||||
responseData.SetControlValue(ControlNameSuffix + "Town", Town);
|
||||
if (StringUtil.IsEmpty(Town))
|
||||
if (StringUtil.IsEmpty(Town) && populated)
|
||||
responseData.SetControlError(ControlNameSuffix + "Town", Model.Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(Town) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Town))
|
||||
responseData.SetControlError(ControlNameSuffix + "Town", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Town)]);
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
@* Action buttons *@
|
||||
<div class="spacer2"></div>
|
||||
<div class="row">
|
||||
<div class="col-6 text-right"><button type="button" class="sax-button" value="" onclick="sax.closeProfileSportExperience();">@Localiser["label.close"]</button></div>
|
||||
<div class="col text-right pr12"><button type="button" class="sax-button" value="" onclick="sax.closeProfileSportExperience();">@Localiser["label.close"]</button></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
@* Organisation controls - Address *@
|
||||
@model SaxModel_Online
|
||||
@inject SaxLocaliser Localiser
|
||||
|
||||
@if (!Model.RegisterView("Views/Common/OrganisationControls-Address")) return;
|
||||
@* NB Organisation address controls may be present more than once on a page, eg. Profile Organisation. *@
|
||||
|
||||
@* Organisation address - Line 1 *@
|
||||
<div class="sax-form-control OrganisationAddressLine1">
|
||||
@@ -52,7 +51,7 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for=""><span>@Localiser["label.town"]</span><span class="required"> *</span></label>
|
||||
<label for=""><span>@Localiser["label.town"]</span><span class="required"> (*)</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
@@ -86,7 +85,7 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for=""><span>@Localiser["label.postalCode"]</span></label>
|
||||
<label for=""><span>@Localiser["label.postal.code"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
@* Organisation controls - Contact *@
|
||||
@model SaxModel_Online
|
||||
@inject SaxLocaliser Localiser
|
||||
@* NB Organisation contact controls may be present more than once on a page, eg. Profile Organisation. *@
|
||||
|
||||
@if (!Model.RegisterView("Views/Common/OrganisationControls-Contact")) return;
|
||||
<style>
|
||||
.OrganisationContactMethods .ContactMethods
|
||||
{
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
@* Organisation controls - Core *@
|
||||
@model SaxModel_Online
|
||||
@inject SaxLocaliser Localiser
|
||||
|
||||
@if (!Model.RegisterView("Views/Common/OrganisationControls-Core")) return;
|
||||
@* NB Core Organisation controls may be present more than once on a page, eg. Profile Organisation. *@
|
||||
|
||||
@* Organisation name *@
|
||||
<div class="sax-form-control OrganisationName">
|
||||
|
||||
@@ -154,6 +154,21 @@
|
||||
background-image: url('../img/action/users24.png');
|
||||
}
|
||||
|
||||
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-mail
|
||||
{
|
||||
background-image: url('../img/action/mail24.png');
|
||||
}
|
||||
|
||||
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-location
|
||||
{
|
||||
background-image: url('../img/action/location-24.png');
|
||||
}
|
||||
|
||||
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-image
|
||||
{
|
||||
background-image: url('../img/action/image-24.png');
|
||||
}
|
||||
|
||||
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-process
|
||||
{
|
||||
background-image: url('../img/action/process24.png');
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 542 B |
Binary file not shown.
|
After Width: | Height: | Size: 794 B |
Binary file not shown.
|
After Width: | Height: | Size: 1001 B |
Binary file not shown.
|
After Width: | Height: | Size: 811 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
@@ -420,17 +420,14 @@
|
||||
{
|
||||
var $frmCtrls = $('.sax-form-control', $(context || doc.body)).removeClass('sax-error');
|
||||
sax.clearControlErrors(context);
|
||||
var values = (controlValues || []);
|
||||
var valuesLen = values.length;
|
||||
for (var valIdx = 0; valIdx < valuesLen; valIdx++)
|
||||
for (let ctrlValue of controlValues || [])
|
||||
{
|
||||
let ctrlValue = values[valIdx];
|
||||
$frmCtrls.each(function (idx, frmCtrl)
|
||||
{
|
||||
var $frmCtrl = $(frmCtrl);
|
||||
if (!$frmCtrl.hasClass(ctrlValue.controlName)) return;
|
||||
var $ctrl = $('input,textarea,select', $frmCtrl);
|
||||
if ($ctrl.length && $ctrl.prop('name') == ctrlValue.controlName && ctrlValue.value)
|
||||
var $ctrl = $('sax-input,sax-textarea,sax-select', $frmCtrl);
|
||||
if ($ctrl.length && sax.isDef(ctrlValue.value))
|
||||
$ctrl.val(ctrlValue.value);
|
||||
if (ctrlValue.error)
|
||||
$frmCtrl.addClass('sax-error').find('.sax-message').text(ctrlValue.error);
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
$('input.OrganisationAddressProvince', $frm.org).val(address.province);
|
||||
$('input.OrganisationAddressCountry', $frm.org).val(address.country);
|
||||
$('input.OrganisationAddressPostalCode', $frm.org).val(address.postalCode);
|
||||
sax.openDialog($dlg.org, 640, 800);
|
||||
sax.openDialog($dlg.org, 720, 840);
|
||||
}
|
||||
po.storeOrganisation = function ()
|
||||
{
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
{
|
||||
let frm = se.$frm.sportExp;
|
||||
$('.sax-input,.sax-textarea,.sax-select,.UserSportExperienceId,.UserSportExperienceExists', frm).val('').prop('autofocus', null);
|
||||
sax.clearControlErrors(frm);
|
||||
}
|
||||
se.fn.updateSportExperience = function (item, $item)
|
||||
{
|
||||
|
||||
@@ -57,11 +57,15 @@
|
||||
ps.addProfileSport = function ()
|
||||
{
|
||||
//sax.debug('addProfileSport');
|
||||
ps.clearProfileSport();
|
||||
sax.openDialog($dlg.proSpt.dialog('option', 'title', sax.dlg.title.addUserSport), 640, 480);
|
||||
}
|
||||
ps.clearProfileSport = function ()
|
||||
{
|
||||
let dlg = $dlg.proSpt;
|
||||
$('.UserSportId,.ProfileSportExists,#ifProfileSportId,input.sax-input,textarea.sax-textarea,select.sax-select', dlg).val('');
|
||||
$('.SelectSport', dlg).show();
|
||||
dlg.dialog('option', 'title', sax.dlg.title.addUserSport);
|
||||
sax.openDialog(dlg, 640, 480);
|
||||
sax.clearControlErrors(dlg);
|
||||
}
|
||||
ps.updateProfileSport = function (item)
|
||||
{
|
||||
@@ -73,6 +77,7 @@
|
||||
ps.doUpdateProfileSport = function (response)
|
||||
{
|
||||
//sax.debug('doUpdateProfileSport', response);
|
||||
ps.clearProfileSport();
|
||||
let dlg = $dlg.proSpt;
|
||||
let item = response.sport;
|
||||
$('.UserSportId', dlg).val(item.id);
|
||||
@@ -83,8 +88,7 @@
|
||||
$('#cbProfileSportParticipation', dlg).val(item.sportParticipationCode);
|
||||
$('#cbProfileSportOfficiating', dlg).val(item.sportOfficiatingCode);
|
||||
$('.SelectSport', dlg).hide();
|
||||
dlg.dialog('option', 'title', sax.dlg.title.updateUserSport);
|
||||
sax.openDialog(dlg, 640, 480);
|
||||
sax.openDialog(dlg.dialog('option', 'title', sax.dlg.title.updateUserSport), 640, 480);
|
||||
}
|
||||
sax.selectUserSport = function (sport)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user