Disable shop change from partner.
This commit is contained in:
@@ -222,51 +222,45 @@ namespace BodyshopPartner.ViewModels
|
|||||||
{
|
{
|
||||||
ShopData = Data.bodyshops.ToObject<ObservableCollection<Bodyshop>>();
|
ShopData = Data.bodyshops.ToObject<ObservableCollection<Bodyshop>>();
|
||||||
}
|
}
|
||||||
string SettingsSelectedShopUuid = Properties.Settings.Default.LastSelectedShop;
|
|
||||||
if (string.IsNullOrEmpty(SettingsSelectedShopUuid))
|
ActiveShop = ShopData.Where(_ => _.AssociationActive == true).FirstOrDefault();
|
||||||
{
|
Properties.Settings.Default.LastSelectedShop = ActiveShop.Id ?? null;
|
||||||
ActiveShop = ShopData[0] ?? null;
|
|
||||||
Properties.Settings.Default.LastSelectedShop = ShopData[0]?.Id ?? null;
|
|
||||||
Properties.Settings.Default.Save();
|
Properties.Settings.Default.Save();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ActiveShop = ShopData.Where(_ => _.Id == SettingsSelectedShopUuid).FirstOrDefault();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SetActiveBodyshop()
|
public async Task SetActiveBodyshop()
|
||||||
{
|
{
|
||||||
IndeterminateLoading = true;
|
//IndeterminateLoading = true;
|
||||||
foreach (var s in ShopData)
|
//foreach (var s in ShopData)
|
||||||
{
|
//{
|
||||||
if (s.Id == ActiveShop?.Id) s.AssociationActive = true;
|
// if (s.Id == ActiveShop?.Id) s.AssociationActive = true;
|
||||||
else s.AssociationActive = false;
|
// else s.AssociationActive = false;
|
||||||
var r = new GraphQLRequest
|
// var r = new GraphQLRequest
|
||||||
{
|
// {
|
||||||
Query = @"
|
// Query = @"
|
||||||
mutation UPDATE_ASSOCIATION($assocId: uuid, $assocActive: Boolean) {
|
// mutation UPDATE_ASSOCIATION($assocId: uuid, $assocActive: Boolean) {
|
||||||
update_associations(where: {id: {_eq: $assocId}}, _set: {active: $assocActive}) {
|
// update_associations(where: {id: {_eq: $assocId}}, _set: {active: $assocActive}) {
|
||||||
returning {
|
// returning {
|
||||||
id
|
// id
|
||||||
active
|
// active
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
",
|
//",
|
||||||
Variables = new
|
// Variables = new
|
||||||
{
|
// {
|
||||||
assocId = s.AssociationId,
|
// assocId = s.AssociationId,
|
||||||
assocActive = s.AssociationActive
|
// assocActive = s.AssociationActive
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
await Utils.GraphQL.ExecuteQuery(r);
|
// await Utils.GraphQL.ExecuteQuery(r);
|
||||||
}
|
//}
|
||||||
Properties.Settings.Default.LastSelectedShop = ActiveShop?.Id;
|
//Properties.Settings.Default.LastSelectedShop = ActiveShop?.Id;
|
||||||
Properties.Settings.Default.Save();
|
//Properties.Settings.Default.Save();
|
||||||
Utils.AppMetaData.ActiveShopId = ActiveShop?.Id;
|
//Utils.AppMetaData.ActiveShopId = ActiveShop?.Id;
|
||||||
Utils.AppMetaData.ShopRegion = ActiveShop?.RegionConfig;
|
//Utils.AppMetaData.ShopRegion = ActiveShop?.RegionConfig;
|
||||||
IndeterminateLoading = false;
|
//IndeterminateLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddHttpStatus(string s)
|
public void AddHttpStatus(string s)
|
||||||
|
|||||||
Reference in New Issue
Block a user