Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 119.00 KB | None | 0 0
  1. diff --git a/application/lib/sr/app/tags.py b/application/lib/sr/app/tags.py
  2. index ceba61f..e3acafe 100644
  3. --- a/application/lib/sr/app/tags.py
  4. +++ b/application/lib/sr/app/tags.py
  5. @@ -41,6 +41,14 @@ def get_tag_groups_for_entity(entity_key, domain='VenueGroupClient', privacy_fil
  6.  
  7. return cached_results
  8.  
  9. +
  10. +def get_tag_groups_for_venue(venue, domain='VenueGroupClient', privacy_filter=None, include_deleted=False):
  11. + global_tag_groups = \
  12. + get_tag_groups_for_entity(venue.venue_group.key(), domain, privacy_filter)
  13. + local_tag_groups = get_tag_groups_for_entity(venue.key(), domain, privacy_filter)
  14. + return global_tag_groups + local_tag_groups
  15. +
  16. +
  17. def invalidate_tag_groups_cache(entity_key, domain='VenueGroupClient'):
  18. cache_key = _get_tags_cache_key(entity_key, domain)
  19. entitymemcache.invalidate_cached_results(cache_key, _GET_TAGS_NAMESPACE)
  20. @@ -65,7 +73,7 @@ def filter_hash_to_json(tags):
  21. pass
  22. return tag_list
  23.  
  24. -def create_or_update_tag_group(venue,delete, is_new_group, group_id, category, color, privacy, tag_list, domain='VenueGroupClient'):
  25. +def create_or_update_tag_group(venue,delete, is_new_group, group_id, category, color, privacy, tag_list, scope, type, disabled, domain='VenueGroupClient'):
  26. error_message = None
  27. tag_group = None
  28. modified = False
  29. @@ -75,24 +83,45 @@ def create_or_update_tag_group(venue,delete, is_new_group, group_id, category, c
  30. except:
  31. tag_group = None
  32. error_message = 'There was an error processing tag changes.'
  33. -
  34. +
  35. if delete:
  36. if tag_group:
  37. tag_group.delete()
  38. modified = True
  39. else:
  40. error_message = 'There was an error processing tag changes.'
  41. -
  42. +
  43. if modified:
  44. invalidate_tag_groups_cache(tag_group.entity_key, tag_group.domain)
  45. -
  46. +
  47. return error_message, tag_group
  48. -
  49. +
  50. + if disabled is not None and tag_group.is_default():
  51. + tag_group.disabled = int(disabled)
  52. + tag_group.save()
  53. + invalidate_tag_groups_cache(tag_group.entity_key, tag_group.domain)
  54. + return None, tag_group
  55. +
  56. if not error_message and tag_group is None:
  57. tag_group = TagGroup()
  58.  
  59. if not error_message:
  60. +<<<<<<< Updated upstream
  61. + if tag_group.type == TagGroup.get_type_code(TagGroup.UNCATEGORIZED_PREFERENCE):
  62. +=======
  63. +<<<<<<< Updated upstream
  64. tag_group.entity_key = venue.venue_group.key()
  65. +=======
  66. + if tag_group.type == TagGroupManager.get_type_code(TagGroupManager.UNCATEGORIZED_PREFERENCE):
  67. +>>>>>>> Stashed changes
  68. + if int(scope) == TagGroup.VENUE_SCOPE:
  69. + tag_group.entity_key = venue.key()
  70. + else:
  71. + tag_group.entity_key = venue.venue_group.key()
  72. +<<<<<<< Updated upstream
  73. +=======
  74. +>>>>>>> Stashed changes
  75. +>>>>>>> Stashed changes
  76. tag_group.name = category
  77. tag_group.domain = domain
  78. tag_group.privacy = privacy
  79. @@ -100,7 +129,7 @@ def create_or_update_tag_group(venue,delete, is_new_group, group_id, category, c
  80. tag_group.tags = tag_list
  81. TagGroupManager.save(tag_group)
  82. modified = True
  83. -
  84. +
  85. if modified:
  86. invalidate_tag_groups_cache(tag_group.entity_key, tag_group.domain)
  87.  
  88. diff --git a/application/lib/sr/db/model/taggroup.py b/application/lib/sr/db/model/taggroup.py
  89. index def2609..57ecf3c 100644
  90. --- a/application/lib/sr/db/model/taggroup.py
  91. +++ b/application/lib/sr/db/model/taggroup.py
  92. @@ -6,7 +6,44 @@ from base import Model
  93.  
  94.  
  95. class TagGroup(Model):
  96. +<<<<<<< Updated upstream
  97. +
  98. + UNCATEGORIZED_PREFERENCE = 'Uncategorized'
  99. + CHAMPAGNE_PREFERENCE = 'Champagne',
  100. + LIQUOR_PREFERENCE = 'Liquor',
  101. + WINE_PREFERENCE = 'Wine'
  102. + SEATING_PREFERENCE = 'Seating'
  103. + ALLERGY_PREFERENCE = 'Allergy'
  104. + ORIGIN_PREFERENCE = 'Origin'
  105. +=======
  106. +<<<<<<< Updated upstream
  107.  
  108. +=======
  109. +
  110. +>>>>>>> Stashed changes
  111. +
  112. + VENUE_GROUP_SCOPE = 1
  113. + VENUE_SCOPE = 0
  114. +
  115. +<<<<<<< Updated upstream
  116. + TYPE_CHOICES = {
  117. + 0: UNCATEGORIZED_PREFERENCE,
  118. + 1: ALLERGY_PREFERENCE,
  119. + 2: WINE_PREFERENCE,
  120. + 3: LIQUOR_PREFERENCE,
  121. + 4: CHAMPAGNE_PREFERENCE,
  122. + 5: SEATING_PREFERENCE,
  123. + 6: ORIGIN_PREFERENCE
  124. + }
  125. +
  126. + @classmethod
  127. + def get_type_code(cls, name):
  128. + choice_code_lookup = dict(zip(TagGroup.TYPE_CHOICES.values(), TagGroup.TYPE_CHOICES.keys()))
  129. + return choice_code_lookup.get(name)
  130. +
  131. +=======
  132. +>>>>>>> Stashed changes
  133. +>>>>>>> Stashed changes
  134. class Meta:
  135. app_label = 'nightloop'
  136.  
  137. @@ -15,6 +52,8 @@ class TagGroup(Model):
  138. )
  139.  
  140. _display_getters_ = (
  141. + 'is_global',
  142. + 'is_default'
  143. )
  144.  
  145. entity_key = KeyProperty()
  146. @@ -23,10 +62,32 @@ class TagGroup(Model):
  147. privacy = db.StringProperty(default='PUBLIC', choices=['PUBLIC', 'PRIVATE'])
  148. color_hex = db.StringProperty()
  149. tags = db.StringListProperty()
  150. +<<<<<<< Updated upstream
  151. + type = db.IntegerProperty(default=0, choices=TYPE_CHOICES.keys())
  152. + disabled = db.IntegerProperty(default=0, choices=[0,1])
  153. +=======
  154. +<<<<<<< Updated upstream
  155. +=======
  156. + type = db.IntegerProperty(default=0)
  157. + disabled = db.IntegerProperty(default=0, choices=[0,1])
  158. +>>>>>>> Stashed changes
  159. +>>>>>>> Stashed changes
  160. sort_order = db.IntegerProperty(default=0)
  161.  
  162. def is_public(self):
  163. return self.privacy == 'PUBLIC'
  164.  
  165. def is_private(self):
  166. - return self.privacy == 'PRIVATE'
  167. \ No newline at end of file
  168. + return self.privacy == 'PRIVATE'
  169. +
  170. + def is_default(self):
  171. + return self.type > 0
  172. +
  173. + def is_not_default(self):
  174. + return not self.is_default()
  175. +
  176. + def is_global(self):
  177. + return db.get(self.entity_key).kind() == 'nightloop_VenueGroup'
  178. +
  179. + def is_local(self):
  180. + return not self.is_global()
  181. diff --git a/application/lib/sr/db/model/venuegroupclient.py b/application/lib/sr/db/model/venuegroupclient.py
  182. index 3cd3485..160fea8 100644
  183. --- a/application/lib/sr/db/model/venuegroupclient.py
  184. +++ b/application/lib/sr/db/model/venuegroupclient.py
  185. @@ -2,6 +2,17 @@ import datetime
  186. import logging
  187. import re
  188. import json
  189. +<<<<<<< Updated upstream
  190. +from sr.app.tags import get_tag_groups_for_entity
  191. +from sr.db.model.taggroup import TagGroup
  192. +=======
  193. +<<<<<<< Updated upstream
  194. +=======
  195. +from sr.app.tags import get_tag_groups_for_entity
  196. +from sr.db.model.taggroup import TagGroup
  197. +from sr.manager.taggroupmanager import TagGroupManager
  198. +>>>>>>> Stashed changes
  199. +>>>>>>> Stashed changes
  200.  
  201. from sr.util import location as lutil
  202. from ..gaeuser import User as SRUser
  203. @@ -73,6 +84,7 @@ class VenueGroupClient(Model):
  204. 'get_name_last_first_display',
  205. 'get_name_first_first_display',
  206. 'get_name_display',
  207. + 'get_default_tags',
  208. 'get_name_only_display',
  209. 'get_title_company_display',
  210. 'get_phone_number_formatted',
  211. @@ -310,6 +322,44 @@ class VenueGroupClient(Model):
  212. tag_groups[key]['tags'].append(tag)
  213. return tag_groups.values()
  214.  
  215. +<<<<<<< Updated upstream
  216. +=======
  217. +<<<<<<< Updated upstream
  218. +=======
  219. +>>>>>>> Stashed changes
  220. + def get_tags_group_display_by_venue(self, venue):
  221. + """ Will return global and local tags for a given venue
  222. + """
  223. + display_tags = self.get_tags_group_display()
  224. + filtered_tag_groups = map(lambda t: t.id,
  225. + filter(lambda t: t.is_global() or t.entity_key == venue.key(),
  226. + filter(None, TagGroup.get(list(set(map(lambda tag: tag['id'], display_tags)))))
  227. + )
  228. + )
  229. + return filter(lambda t: t['id'] in filtered_tag_groups, display_tags)
  230. +
  231. + def get_default_tags(self):
  232. + default_tags = {}
  233. + global_tag_groups = get_tag_groups_for_entity(self.venue_group)
  234. + global_tags_by_key = {str(x.key()):x for i, x in enumerate(global_tag_groups)}
  235. + orders_list = map(lambda x: str(x.key()), global_tag_groups)
  236. + for tag in self.get_tags_group_display():
  237. + if tag['id'] in orders_list:
  238. + tag_model = (global_tags_by_key[tag['id']] or {})
  239. + if tag_model.is_default():
  240. + tag['tags_list'] = ', '.join(map(lambda x: x.get('tag_name'), tag['tags']))
  241. +<<<<<<< Updated upstream
  242. + tag['type'] = (''.join(TagGroup.TYPE_CHOICES.get(tag_model.type))).lower()
  243. + default_tags[tag['id']] = tag
  244. + return filter(None, map(lambda rank: default_tags.get(rank), orders_list))
  245. +
  246. +=======
  247. + tag['type'] = (''.join(TagGroupManager.TYPE_CHOICES.get(tag_model.type))).lower()
  248. + default_tags[tag['id']] = tag
  249. + return filter(None, map(lambda rank: default_tags.get(rank), orders_list))
  250. +
  251. +>>>>>>> Stashed changes
  252. +>>>>>>> Stashed changes
  253.  
  254. def has_tag(self, tag_hash):
  255. if tag_hash in self.tags:
  256. @@ -358,6 +408,17 @@ class VenueGroupClient(Model):
  257. pass
  258. return ','.join(temp_tags)
  259.  
  260. + def merge_tags_for_venue(self, tags, can_use_private, venue):
  261. + existing_tags = filter(None, TagGroup.get(list(set(map(lambda t: t.split('##')[1], self.tags)))))
  262. + existing_private_tags = filter(lambda t: t.split('##')[0] == "PRIVATE", self.tags)
  263. + self.tags = filter(
  264. + lambda t: t.split('##')[1] in map(
  265. + lambda tag: tag.id, filter(
  266. + lambda inner_tag: not(inner_tag.is_global() or inner_tag.entity_key == venue.key()), existing_tags
  267. + )
  268. + ), self.tags) + tags + ([] if can_use_private else existing_private_tags)
  269. +
  270. +
  271. def merge_tags(self, tags, can_use_private):
  272. if can_use_private:
  273. self.tags = tags
  274. diff --git a/application/lib/sr/manager/reservationactualauditmanager.py b/application/lib/sr/manager/reservationactualauditmanager.py
  275. index 7340179..65fdc88 100644
  276. --- a/application/lib/sr/manager/reservationactualauditmanager.py
  277. +++ b/application/lib/sr/manager/reservationactualauditmanager.py
  278. @@ -175,7 +175,7 @@ class ReservationActualAuditManager(object):
  279. 'duration': 'changed duration from %s to %s' % (old_value, curr_value),
  280. 'phone_number': 'changed phone number from %s to %s' % (old_value, curr_value),
  281. 'email': 'changed email address from %s to %s' % (old_value, curr_value),
  282. - 'reservation_type': 'changed reservation type from %s to %s' %
  283. + 'reservation_type': 'changed reservation code from %s to %s' %
  284. (cls.get_reference_prop(old_value, 'name'),
  285. cls.get_reference_prop(curr_value, 'name')),
  286. 'bookedby_user': 'changed Booked by name from %s to %s' % (old_value, curr_value),
  287. diff --git a/application/lib/sr/manager/resgroupmanager.py b/application/lib/sr/manager/resgroupmanager.py
  288. new file mode 100644
  289. index 0000000..cb5ce4a
  290. --- /dev/null
  291. +++ b/application/lib/sr/manager/resgroupmanager.py
  292. @@ -0,0 +1,108 @@
  293. +from sr.db.model.taggroup import TagGroup
  294. +
  295. +
  296. +class ResGroupManager(object):
  297. +
  298. + DOMAIN = 'ReservationActual'
  299. + UNCATEGORIZED_PREFERENCE = 'Uncategorized'
  300. + SPECIAL_OCCASION_PREFERENCE = 'Special Occasions'
  301. + SPECIAL_ATTENTION_PREFERENCE = 'Special Attention'
  302. + SEATING_REQUEST_PREFERENCE = 'Seating Request'
  303. + ALLERGY_PREFERENCE = 'Allergy'
  304. + COMPS_PREFERENCE = 'Comps'
  305. +
  306. + TYPE_CHOICES = {
  307. + 0: UNCATEGORIZED_PREFERENCE,
  308. + 1: ALLERGY_PREFERENCE,
  309. + 2: SPECIAL_OCCASION_PREFERENCE,
  310. + 3: SPECIAL_ATTENTION_PREFERENCE,
  311. + 4: SEATING_REQUEST_PREFERENCE,
  312. + 5: COMPS_PREFERENCE
  313. + }
  314. +
  315. + @staticmethod
  316. + def get_default_tags():
  317. + return [
  318. + {
  319. + 'name': 'Allergy',
  320. + 'tags': ['Nuts', 'Peanuts', 'Seafood', 'Shellfish', 'Vegan', 'Dairy-Free', 'Gluten-Free', 'Shrimp',
  321. + 'Fish', 'Kosher', 'Salt', 'Vegetarian'],
  322. + 'color': '#EEEEEE',
  323. + 'type': ResGroupManager.get_type_code(ResGroupManager.ALLERGY_PREFERENCE)
  324. + },
  325. + {
  326. + 'name': 'Special Occasions',
  327. + 'tags': ['Anniversary', 'Baby Shower', 'Bachelor', 'Bachelorette', 'Birthday', 'Bridal Shower',
  328. + 'Business Meeting', 'Engagement', 'Female Birthday', 'Graduation', 'Male Birthday', 'Wedding',
  329. + 'Special Event', 'Corporate Event'],
  330. + 'color': '#EEEEEE',
  331. + 'type': ResGroupManager.get_type_code(ResGroupManager.SPECIAL_OCCASION_PREFERENCE)
  332. + },
  333. + {
  334. + 'name': 'Special Attention',
  335. + 'tags': ['Alert GM', 'Alert Chef', 'Wheelchair', 'First Time Diner', 'Non-English Speaking',
  336. + 'Highchair', 'Server Request', 'Seperate Checks', 'House Account'],
  337. + 'color': '#EEEEEE',
  338. + 'type': ResGroupManager.get_type_code(ResGroupManager.SPECIAL_ATTENTION_PREFERENCE)
  339. + },
  340. + {
  341. + 'name': 'Seating Request',
  342. + 'tags': ['Patio', 'DJ', 'VIP Area', 'Main', 'Outdoor', 'Corner', 'Kitchen', 'Bar Area', 'Booth',
  343. + 'Round', 'Quiet Table', 'Outdoors'],
  344. + 'color': '#EEEEEE',
  345. + 'type': ResGroupManager.get_type_code(ResGroupManager.SEATING_REQUEST_PREFERENCE)
  346. + },
  347. + {
  348. + 'name': 'Comps',
  349. + 'tags': ['Comp Dessert', 'Comp Champagne', 'Comp Round', 'Comp Appetizer', 'Comp Wine'],
  350. + 'color': '#EEEEEE',
  351. + 'type': ResGroupManager.get_type_code(ResGroupManager.COMPS_PREFERENCE)
  352. + }
  353. + ]
  354. +
  355. + @staticmethod
  356. + def get_type_code(name):
  357. + choice_code_lookup = dict(zip(ResGroupManager.TYPE_CHOICES.values(), ResGroupManager.TYPE_CHOICES.keys()))
  358. + return choice_code_lookup.get(name)
  359. +
  360. + @staticmethod
  361. + def get_by(entity_key=None, domain=DOMAIN):
  362. + query = TagGroup.all()
  363. +
  364. + if entity_key:
  365. + query = query.filter('entity_key', entity_key)
  366. +
  367. + if domain:
  368. + query = query.filter('domain', domain)
  369. +
  370. + return query
  371. +
  372. + @staticmethod
  373. + def get_by_type(entity_key, search_type):
  374. + return TagGroup.all().\
  375. + filter('entity_key', entity_key).\
  376. + filter('domain', ResGroupManager.DOMAIN).\
  377. + filter('type', search_type).get()
  378. +
  379. + @staticmethod
  380. + def save(res_group):
  381. + res_group.put()
  382. +
  383. + @staticmethod
  384. + def bulk_save(res_groups):
  385. + TagGroup.bulk_put(res_groups)
  386. +
  387. + @staticmethod
  388. + def create_default_tags(venue_group):
  389. + rgs = []
  390. + for v in ResGroupManager.get_default_tags():
  391. + if not ResGroupManager.get_by_type(venue_group.key(), v['type']):
  392. + resgroup = TagGroup(entity_key=venue_group.key(),
  393. + name=v['name'],
  394. + tags=v['tags'],
  395. + color_hex=v['color'],
  396. + type=v['type'],
  397. + domain=ResGroupManager.DOMAIN)
  398. + rgs = rgs + [resgroup]
  399. + ResGroupManager.bulk_save(rgs)
  400. +
  401. diff --git a/application/lib/sr/manager/taggroupmanager.py b/application/lib/sr/manager/taggroupmanager.py
  402. index 7c0b831..b1ee22d 100644
  403. --- a/application/lib/sr/manager/taggroupmanager.py
  404. +++ b/application/lib/sr/manager/taggroupmanager.py
  405. @@ -1,10 +1,140 @@
  406. from sr.db.model.taggroup import TagGroup
  407.  
  408. +<<<<<<< Updated upstream
  409. +=======
  410. +<<<<<<< Updated upstream
  411. +=======
  412.  
  413. class TagGroupManager(object):
  414. -
  415. +
  416. + DOMAIN = 'VenueGroupClient'
  417. + UNCATEGORIZED_PREFERENCE = 'Uncategorized'
  418. + CHAMPAGNE_PREFERENCE = 'Champagne',
  419. + LIQUOR_PREFERENCE = 'Liquor',
  420. + WINE_PREFERENCE = 'Wine'
  421. + SEATING_PREFERENCE = 'Seating'
  422. + ALLERGY_PREFERENCE = 'Allergy'
  423. + ORIGIN_PREFERENCE = 'Origin'
  424. +
  425. + TYPE_CHOICES = {
  426. + 0: UNCATEGORIZED_PREFERENCE,
  427. + 1: ALLERGY_PREFERENCE,
  428. + 2: WINE_PREFERENCE,
  429. + 3: LIQUOR_PREFERENCE,
  430. + 4: CHAMPAGNE_PREFERENCE,
  431. + 5: SEATING_PREFERENCE,
  432. + 6: ORIGIN_PREFERENCE
  433. + }
  434. +
  435. + @staticmethod
  436. + def get_default_tags_list():
  437. + return [
  438. + {
  439. + 'name': 'Allergy',
  440. + 'tags': ['Nuts', 'Peanuts', 'Seafood', 'Shellfish', 'Vegan', 'Dairy-Free', 'Gluten-Free', 'Shrimp',
  441. + 'Fish', 'Kosher', 'Salt', 'Vegetarian'],
  442. + 'color': '#EEEEEE',
  443. + 'type': TagGroupManager.get_type_code(TagGroupManager.ALLERGY_PREFERENCE)
  444. + },
  445. + {
  446. + 'name': 'Wine',
  447. + 'tags': ['Bordeaux', 'Cabernet Sauvignon', 'Pinot Noir', 'Chardonnay', 'Pinot Grigio/Pinot Gris',
  448. + 'Reisling', 'Sancerre', 'Sauvignon Blanc', 'Prosecco', 'Rose Champagne', 'Champagne',
  449. + 'Barbaresco', 'Barolo', 'Merlot', 'Cava', 'Chianti', 'Rose', 'Zinfandel', 'Malbec',
  450. + 'Chenin Blanc', 'Dessert Wine', 'Sherry', 'Wine $', 'Wine $$', 'Wine $$$', 'Wine $$$$',
  451. + 'Large Format Wine'],
  452. + 'color': '#EEEEEE',
  453. + 'type': TagGroupManager.get_type_code(TagGroupManager.WINE_PREFERENCE)
  454. + },
  455. + {
  456. + 'name': 'Liquor',
  457. + 'tags': ['Absolut Vodka', 'Belvedere Vodka', 'Bombay Sapphire', 'Chopin', 'Ciroc', 'Courvosier',
  458. + 'Don Julio', 'Grey Goose', 'Hennessy', 'Johnnie Walker Black', 'Ketel One', 'Patron',
  459. + 'Stolichnaya', '1942', 'Campari', 'Johnnie Walker Blue', "Maker's Mark", 'Macallan', 'Bacardi',
  460. + 'Jack Daniels', 'Jameson', 'Crown Royal', 'Remy Martin', 'Glenmorangie', 'Glenfiddich',
  461. + 'Dewers', 'Captain Morgans', 'Hendricks', 'Tanquery', 'Milagro', 'Large Format Liquor',
  462. + "Tito's Vodka"],
  463. + 'color': '#EEEEEE',
  464. + 'type': TagGroupManager.get_type_code(TagGroupManager.LIQUOR_PREFERENCE)
  465. + },
  466. + {
  467. + 'name': 'Champagne',
  468. + 'tags': ['Ace of Spades', 'Cristal', 'Dom Perignon', 'Krug', 'Moet Imperial', 'Moet Rose',
  469. + 'Veuve Clicquot Brut', 'Veuve Clicquot Rose', 'Large Format Champagne'],
  470. + 'color': '#EEEEEE',
  471. + 'type': TagGroupManager.get_type_code(TagGroupManager.CHAMPAGNE_PREFERENCE)
  472. + },
  473. +
  474. + {
  475. + 'name': 'Seating Preference',
  476. + 'tags': ['Patio', 'DJ', 'VIP Area', 'Main', 'Outdoor', 'Corner', 'Kitchen', 'Bar Area', 'Booth',
  477. + 'Round', 'Quiet Table', 'Outdoors'],
  478. + 'color': '#EEEEEE',
  479. + 'type': TagGroupManager.get_type_code(TagGroupManager.SEATING_PREFERENCE)
  480. + },
  481. + {
  482. + 'name': 'Origin',
  483. + 'tags': ['New York', 'Los Angeles', 'San Fransisco', 'Miami', 'Las Vegas', 'Chicago', 'Boston',
  484. + 'Atlanta', 'Austin', 'DC', 'Montreal', 'Toronto', 'Philadelphia', 'Denver', 'London', 'Paris',
  485. + 'Dubai', 'Hong Kong', 'Tel Aviv', 'Berlin', 'Dallas', 'Paris', 'Istanbul', 'Madrid',
  486. + 'Barcelona', 'Vancouver', 'Seattle'],
  487. + 'color': '#EEEEEE',
  488. + 'type': TagGroupManager.get_type_code(TagGroupManager.ORIGIN_PREFERENCE)
  489. + }
  490. + ]
  491. +
  492. + @staticmethod
  493. + def get_type_code(name):
  494. + choice_code_lookup = dict(zip(TagGroupManager.TYPE_CHOICES.values(), TagGroupManager.TYPE_CHOICES.keys()))
  495. + return choice_code_lookup.get(name)
  496. +>>>>>>> Stashed changes
  497. +
  498. +>>>>>>> Stashed changes
  499. +class TagGroupManager(object):
  500. + DEFAULT_TAGS = [
  501. +
  502. + {
  503. + 'name': 'Allergy',
  504. + 'tags': ['Nuts','Peanuts','Seafood','Shellfish','Vegan','Dairy-Free','Gluten-Free','Shrimp','Fish','Kosher','Salt','Vegetarian'],
  505. + 'color': '#EEEEEE',
  506. + 'type': TagGroup.get_type_code(TagGroup.ALLERGY_PREFERENCE)
  507. + },
  508. + {
  509. + 'name': 'Wine',
  510. + 'tags': ['Bordeaux','Cabernet Sauvignon','Pinot Noir','Chardonnay','Pinot Grigio/Pinot Gris','Reisling','Sancerre','Sauvignon Blanc','Prosecco','Rose Champagne','Champagne','Barbaresco','Barolo','Merlot','Cava','Chianti','Rose','Zinfandel','Malbec','Chenin Blanc','Dessert Wine','Sherry','Wine $','Wine $$','Wine $$$','Wine $$$$','Large Format Wine'],
  511. + 'color': '#EEEEEE',
  512. + 'type': TagGroup.get_type_code(TagGroup.WINE_PREFERENCE)
  513. + },
  514. + {
  515. + 'name': 'Liquor',
  516. + 'tags': ['Absolut Vodka','Belvedere Vodka','Bombay Sapphire','Chopin','Ciroc','Courvosier','Don Julio','Grey Goose','Hennessy','Johnnie Walker Black','Ketel One','Patron','Stolichnaya','1942','Campari','Johnnie Walker Blue',"Maker's Mark",'Macallan','Bacardi','Jack Daniels','Jameson','Crown Royal','Remy Martin','Glenmorangie','Glenfiddich','Dewers','Captain Morgans','Hendricks','Tanquery','Milagro','Large Format Liquor',"Tito's Vodka"],
  517. + 'color': '#EEEEEE',
  518. + 'type': TagGroup.get_type_code(TagGroup.LIQUOR_PREFERENCE)
  519. + },
  520. + {
  521. + 'name': 'Champagne',
  522. + 'tags': ['Ace of Spades','Cristal','Dom Perignon','Krug','Moet Imperial','Moet Rose','Veuve Clicquot Brut', 'Veuve Clicquot Rose', 'Large Format Champagne'],
  523. + 'color': '#EEEEEE',
  524. + 'type': TagGroup.get_type_code(TagGroup.CHAMPAGNE_PREFERENCE)
  525. + },
  526. +
  527. + {
  528. + 'name': 'Seating Preference',
  529. + 'tags': ['Patio','DJ','VIP Area','Main','Outdoor','Corner','Kitchen','Bar Area','Booth','Round','Quiet Table','Outdoors'],
  530. + 'color': '#EEEEEE',
  531. + 'type': TagGroup.get_type_code(TagGroup.SEATING_PREFERENCE)
  532. + },
  533. + {
  534. + 'name': 'Origin',
  535. + 'tags': ['New York','Los Angeles','San Fransisco','Miami','Las Vegas','Chicago','Boston','Atlanta','Austin','DC','Montreal','Toronto','Philadelphia','Denver','London','Paris','Dubai','Hong Kong','Tel Aviv','Berlin','Dallas','Paris','Istanbul','Madrid','Barcelona','Vancouver','Seattle'],
  536. + 'color': '#EEEEEE',
  537. + 'type': TagGroup.get_type_code(TagGroup.ORIGIN_PREFERENCE)
  538. + }
  539. +
  540. + ]
  541. +
  542. @staticmethod
  543. - def get_by(entity_key=None, domain=None):
  544. + def get_by(entity_key=None, domain=DOMAIN):
  545. query = TagGroup.all()
  546.  
  547. if entity_key:
  548. @@ -14,6 +144,23 @@ class TagGroupManager(object):
  549. query = query.filter('domain', domain)
  550.  
  551. return query
  552. +<<<<<<< Updated upstream
  553. +
  554. + @staticmethod
  555. + def get_by_type(entity_key, search_type):
  556. + return TagGroup.all().filter('entity_key', entity_key).filter('type', search_type).get()
  557. +=======
  558. +<<<<<<< Updated upstream
  559. +=======
  560. +
  561. + @staticmethod
  562. + def get_by_type(entity_key, search_type):
  563. + return TagGroup.all().\
  564. + filter('domain', TagGroupManager.DOMAIN).\
  565. + filter('entity_key', entity_key).\
  566. + filter('type', search_type).get()
  567. +>>>>>>> Stashed changes
  568. +>>>>>>> Stashed changes
  569.  
  570. @staticmethod
  571. def save(tag_group):
  572. @@ -21,4 +168,37 @@ class TagGroupManager(object):
  573.  
  574. @staticmethod
  575. def bulk_save(tag_groups):
  576. - TagGroup.bulk_put(tag_groups)
  577. \ No newline at end of file
  578. +<<<<<<< Updated upstream
  579. +=======
  580. +<<<<<<< Updated upstream
  581. + TagGroup.bulk_put(tag_groups)
  582. +=======
  583. +>>>>>>> Stashed changes
  584. + TagGroup.bulk_put(tag_groups)
  585. +
  586. + @staticmethod
  587. + def create_default_tags(venue_group):
  588. + tgs = []
  589. +<<<<<<< Updated upstream
  590. + for v in TagGroupManager.DEFAULT_TAGS:
  591. +=======
  592. + for v in TagGroupManager.get_default_tags_list():
  593. +>>>>>>> Stashed changes
  594. + if not TagGroupManager.get_by_type(venue_group.key(), v['type']):
  595. + tag = TagGroup(entity_key=venue_group.key(),
  596. + name=v['name'],
  597. + tags=v['tags'],
  598. + color_hex=v['color'],
  599. + type=v['type'],
  600. +<<<<<<< Updated upstream
  601. + domain='VenueGroupClient')
  602. + tgs = tgs + [tag]
  603. + TagGroupManager.bulk_save(tgs)
  604. +
  605. +=======
  606. + domain=TagGroupManager.DOMAIN)
  607. + tgs = tgs + [tag]
  608. + TagGroupManager.bulk_save(tgs)
  609. +
  610. +>>>>>>> Stashed changes
  611. +>>>>>>> Stashed changes
  612. diff --git a/application/lib/sr/manager/venuegroupmanager.py b/application/lib/sr/manager/venuegroupmanager.py
  613. index b0b639f..27e6f5a 100644
  614. --- a/application/lib/sr/manager/venuegroupmanager.py
  615. +++ b/application/lib/sr/manager/venuegroupmanager.py
  616. @@ -1,5 +1,6 @@
  617. from google.appengine.ext import db
  618. from sr.db.model.venuegroup import VenueGroup
  619. +from sr.manager.taggroupmanager import TagGroupManager
  620.  
  621.  
  622. class VenueGroupManager(object):
  623. @@ -50,4 +51,7 @@ class VenueGroupManager(object):
  624.  
  625. @staticmethod
  626. def save(venue_group):
  627. - venue_group.put()
  628. \ No newline at end of file
  629. + is_venue_created = venue_group.is_saved()
  630. + venue_group.put()
  631. + if is_venue_created:
  632. + TagGroupManager.create_default_tags(venue_group)
  633. \ No newline at end of file
  634. diff --git a/application/site/app.conf.yaml b/application/site/app.conf.yaml
  635. index b725011..dfe3320 100644
  636. --- a/application/site/app.conf.yaml
  637. +++ b/application/site/app.conf.yaml
  638. @@ -8,7 +8,7 @@ instance_class: F4
  639. # other code will require that this is of the format: INTEGER-INTEGER
  640. # think v1.0 -> 1-0
  641.  
  642. -version: 9-351-status
  643. +version: 9-351-status
  644.  
  645. # Set the deployment evironment here instead of checking Domain name.
  646. env_variables:
  647. diff --git a/application/site/apps/sr_api_venue_mgr_sync/models.py b/application/site/apps/sr_api_venue_mgr_sync/models.py
  648. index 762029d..980b2fc 100644
  649. --- a/application/site/apps/sr_api_venue_mgr_sync/models.py
  650. +++ b/application/site/apps/sr_api_venue_mgr_sync/models.py
  651. @@ -1241,7 +1241,7 @@ class ClientGroupSyncModel(SyncModel, NdbSyncModelMixin):
  652. self.batch = True
  653.  
  654. def query(self):
  655. - 'Sync global and local client groups'
  656. + 'Sync global and local client codes'
  657. local_results = super(ClientGroupSyncModel, self).query()
  658. global_results = self.query_kind('ClientGroupGlobal') # get all results
  659. results = local_results + global_results
  660. diff --git a/application/site/apps/sr_site_venue_mgr/decorators/reservation.py b/application/site/apps/sr_site_venue_mgr/decorators/reservation.py
  661. index 082a86a..645015a 100644
  662. --- a/application/site/apps/sr_site_venue_mgr/decorators/reservation.py
  663. +++ b/application/site/apps/sr_site_venue_mgr/decorators/reservation.py
  664. @@ -2,10 +2,10 @@ from sr.app import feature as feature_app, venue as venue_app, shift_app, \
  665. venuegroupclient as venuegroupclient_app, tableitem as tableitem_app
  666.  
  667. from sr.db.model.venueuser import VenuePrivilegeLevel
  668. -from sr.manager.reservation_type_manager import ReservationTypeManager
  669. from sr.manager.venuesettingsmanager import VenueSettingsManager
  670. from sr.util.rendermodel import create_render_models
  671. from sr_site_venue_mgr import manager as manager_app
  672. +from sr.app import venue as venue_app, feature as features_app, tags as tags_app
  673.  
  674.  
  675. class add_reservation_form_params(object):
  676. @@ -21,6 +21,9 @@ class add_reservation_form_params(object):
  677. venue_privilege_level = kwargs['venue_privilege_level']
  678. _v_user = venue_app.get_venue_user(venue, request.user)
  679. content = {}
  680. + current_venue_user = venue_app.get_venue_user(venue, request.user)
  681. + can_modify_private_data = features_app.can_manage_private_data(current_venue_user, request.user)
  682. + privacy = 'PUBLIC' if not can_modify_private_data else None
  683. content['booked_by_key'] = request.user.id
  684. content['can_pick_seating'] = venue_privilege_level in (VenuePrivilegeLevel.SUPERUSER, VenuePrivilegeLevel.MANAGER, VenuePrivilegeLevel.SUBMANAGER)
  685. content['venue_eta_options'] = venue.get_allowable_eta_options()
  686. @@ -32,7 +35,10 @@ class add_reservation_form_params(object):
  687. all_table_inventory_items = create_render_models(all_table_inventory_items, with_locale=venue.get_locale(),
  688. properties=('id', 'item_code', 'party_size_range_display',))
  689. content['all_table_inventory_items'] = all_table_inventory_items
  690. - content['reservation_types'] = ReservationTypeManager.as_select_options(venue)
  691. + content['reservation_types'] = tags_app.get_tag_groups_for_venue(venue,
  692. + domain='ReservationActual',
  693. + privacy_filter=privacy)
  694. + content['reservation_tags_url'] = '%s/data/reservationtags' % venue.get_manager_base_url()
  695. content['reservations_require_approval'] = None
  696. content['can_edit_client_tags'] = None
  697. content['is_basic_user'] = venue_privilege_level == VenuePrivilegeLevel.BASIC
  698. diff --git a/application/site/apps/sr_site_venue_mgr/form/tags.py b/application/site/apps/sr_site_venue_mgr/form/tags.py
  699. index 153d951..8bcfdf1 100644
  700. --- a/application/site/apps/sr_site_venue_mgr/form/tags.py
  701. +++ b/application/site/apps/sr_site_venue_mgr/form/tags.py
  702. @@ -2,19 +2,33 @@ import logging
  703. import re
  704. from gae.serializers import json
  705. from sr.app import tags
  706. +from sr.db.model.taggroup import TagGroup
  707. +
  708.  
  709. def process_tag_group_from_post(post):
  710. error_message = None
  711.  
  712. group_id = post.get('tag_group_id',None)
  713. delete = post.get('delete', False)
  714. + disabled = post.get('disabled', None)
  715.  
  716. - if delete:
  717. - return error_message, delete, False, group_id, None, None, None, None
  718. + if delete or disabled:
  719. + return error_message, delete, False, group_id, None, None, None, None, None, None, disabled
  720.  
  721. category = post.get('category_name',None)
  722. color = post.get('color',None)
  723. privacy = post.get('privacy',None)
  724. +<<<<<<< Updated upstream
  725. + scope = post.get('scope', TagGroup.VENUE_SCOPE)
  726. + type = post.get('type', 0)
  727. +=======
  728. +<<<<<<< Updated upstream
  729. +=======
  730. + scope = post.get('scope', TagGroup.VENUE_SCOPE)
  731. + type = post.get('type', 0)
  732. + tags_type = post.get('tags_type', 0)
  733. +>>>>>>> Stashed changes
  734. +>>>>>>> Stashed changes
  735. tag_list = post.getlist('tags[]')
  736.  
  737. is_new_group =group_id in [None,'']
  738. @@ -38,7 +52,15 @@ def process_tag_group_from_post(post):
  739. privacy = 'PUBLIC'
  740. error_message = 'Invalid privacy setting'
  741.  
  742. +<<<<<<< Updated upstream
  743. + return error_message, delete, is_new_group, group_id, category, color, privacy, tag_list, scope, type, disabled
  744. +=======
  745. +<<<<<<< Updated upstream
  746. return error_message, delete, is_new_group, group_id, category, color, privacy, tag_list
  747. +=======
  748. + return error_message, delete, is_new_group, group_id, category, color, privacy, tag_list, scope, type, disabled, tags_type
  749. +>>>>>>> Stashed changes
  750. +>>>>>>> Stashed changes
  751.  
  752.  
  753. def process_tag_group_order(post):
  754. diff --git a/application/site/apps/sr_site_venue_mgr/urls.py b/application/site/apps/sr_site_venue_mgr/urls.py
  755. index 047a148..74cde54 100644
  756. --- a/application/site/apps/sr_site_venue_mgr/urls.py
  757. +++ b/application/site/apps/sr_site_venue_mgr/urls.py
  758. @@ -77,6 +77,7 @@ urlpatterns += patterns(
  759. (r'^manager/(?P<venue_id>[\w\-_]+)/data/bookedbynames$', 'get_bookedby_names'),
  760. (r'^manager/(?P<venue_id>[\w\-_]+)/data/seatingareastables$', 'get_seatingareastables'),
  761. (r'^manager/(?P<venue_id>[\w\-_]+)/data/tags$', 'get_tags'),
  762. + (r'^manager/(?P<venue_id>[\w\-_]+)/data/reservationtags$', 'get_reservation_tags'),
  763. (r'^manager/(?P<venue_id>[\w\-_]+)/venue/search$', 'view_all_venues'),
  764. )
  765.  
  766. @@ -335,7 +336,7 @@ urlpatterns += patterns(
  767. (r'^manager/(?P<venue_id>[\w\-_]+)/blocks/(?P<block_id>[\w\-_]+)$', 'view_block'),
  768. )
  769.  
  770. -# client groups
  771. +# client codes
  772. urlpatterns += patterns(
  773. 'sr_site_venue_mgr.views.client_groups',
  774. (r'^manager/(?P<venue_id>[\w\-_]+)/clientgroups$', 'view_groups'),
  775. diff --git a/application/site/apps/sr_site_venue_mgr/views/clients.py b/application/site/apps/sr_site_venue_mgr/views/clients.py
  776. index 6124ba4..4784792 100644
  777. --- a/application/site/apps/sr_site_venue_mgr/views/clients.py
  778. +++ b/application/site/apps/sr_site_venue_mgr/views/clients.py
  779. @@ -34,7 +34,7 @@ from sr.manager.venuesettingsmanager import VenueSettingsManager
  780. from sr.stats.groups import ClientGroupStatistics
  781. from sr.util import formatters, cryptography, searchcomposite, location as lutil
  782. from sr.util.filters import phone_number_filter
  783. -from sr.util.rendermodel import create_render_models, set_cached_property
  784. +from sr.util.rendermodel import create_render_models, set_cached_property, serialize_render_model
  785. from sr.util.strings import escape
  786. from sr_common.formutil import zip_params
  787. from sr_site_infra.uploads import get_venue_client_photo_key, crop_client_photo
  788. @@ -836,13 +836,13 @@ def _handle_view_client_profile(request, venue, venue_privilege_level, venue_gro
  789. venue_group_client.anniversary = anniversary
  790.  
  791. if can_manage_client_tags:
  792. - venue_group_client.merge_tags(tags, can_view_private_tags)
  793. + venue_group_client.merge_tags_for_venue(tags, can_view_private_notes, venue)
  794.  
  795. if can_view_private_notes:
  796. venue_group_client.private_notes = private_notes
  797.  
  798. client_groups_changed = list(set(client_groups).symmetric_difference(set(venue_group_client.client_groups)))
  799. - venue_group_client.client_groups = client_groups # outright replace the client groups
  800. + venue_group_client.client_groups = client_groups # outright replace the client codes
  801. cgroups = ClientGroupManager.get_multi(client_groups)
  802.  
  803. venue_group_client.status = ''
  804. @@ -943,33 +943,35 @@ The below client profile has been created for the unlinked reservation.
  805. group_name=group.name,
  806. term_formatted=plan.term_formatted,
  807. description=membership_plan.description))
  808. + vgc_rendered = None
  809. if venue_group_client is not None:
  810. - venue_group_client = create_render_models(venue_group_client, with_locale=venue.get_locale(), convert_to_currency=venue.get_currency_code(),
  811. + vgc_rendered = create_render_models(venue_group_client, with_locale=venue.get_locale(), convert_to_currency=venue.get_currency_code(),
  812. properties=('name_display', 'phone_number_formatted', 'phone_number_locale', 'phone_number_alt_formatted', 'phone_number_alt_locale', 'email_address', 'gender_display',
  813. 'total_spend_formatted_no_decimals', 'total_visits', 'avg_rating_formatted', 'address_formatted', 'address', 'address_2',
  814. 'notes', 'first_name', 'last_name', 'title', 'company', 'title_company_display', 'status_display', 'name_only_display', 'gender', 'status',
  815. - 'birthday_display', 'birthday_day', 'birthday_month', 'tags_display', 'tags_group_display', 'is_contact_private',
  816. + 'birthday_display', 'birthday_day', 'birthday_month', 'tags_display', 'is_contact_private',
  817. 'is_email_address_viewable', 'is_email_address_editable', 'is_phone_viewable', 'is_phone_editable', 'is_address_editable',
  818. 'city_display', 'state_display', 'country_display', 'postal_code_display', 'is_phone_alt_viewable', 'is_phone_alt_editable',
  819. 'is_city_editable', 'is_state_editable', 'is_postal_code_editable', 'is_country_editable', 'created_by_display',
  820. 'is_email_address_alt_editable', 'is_email_address_alt_viewable', 'salutation', 'email_address_alt',
  821. - 'anniversary_display', 'anniversary_day', 'anniversary_month', 'total_spend_per_cover_formatted',
  822. + 'anniversary_display', 'anniversary_day', 'anniversary_month', 'total_spend_per_cover_formatted', 'default_tags',
  823. 'total_spend_per_visit_formatted', 'total_noshows', 'total_cancellations', 'is_member_profile',
  824. 'photo', 'photo_crop_info',), cached_properties={'can_view_contact_info' : can_view_private_notes,
  825. 'can_view_private_tags': can_view_private_tags,
  826. 'current_user_id' : request.user.id,
  827. 'can_view_all_contact_info' : can_view_all_contact_info})
  828.  
  829. + vgc_rendered.add_property('tags_group_display', venue_group_client.get_tags_group_display_by_venue(venue))
  830. month_name_options = formatters.get_month_name_options(venue.get_locale())
  831. is_month_before_day = formatters.is_formatted_month_before_day(venue.get_locale())
  832.  
  833. - if can_view_private_notes and venue_group_client is not None:
  834. - venue_group_client.add_property('private_notes', private_notes)
  835. + if can_view_private_notes and vgc_rendered is not None:
  836. + vgc_rendered.add_property('private_notes', private_notes)
  837.  
  838. tags_url = '%s/data/tags' % venue.get_manager_base_url()
  839.  
  840. content = {
  841. - 'venue_group_client': venue_group_client,
  842. + 'venue_group_client': vgc_rendered,
  843. 'currentday_formatted': today_date_formats['currentday_formatted'],
  844. 'currentday_formatted_default': today_date.strftime('%m/%d/%Y'),
  845. 'status_options_map': status_options_map,
  846. @@ -995,10 +997,10 @@ The below client profile has been created for the unlinked reservation.
  847. 'error_msg': error_msg
  848. }
  849.  
  850. - if venue_group_client:
  851. + if vgc_rendered:
  852. redirect_url = gae.blobstore.utils.create_redirect_url(
  853. get_venue_client_photo_key,
  854. - venue_group_client.model.id)
  855. + vgc_rendered.model.id)
  856. content['upload_redirect_url'] = redirect_url
  857.  
  858. return render_to_response('Nightloop.Templates.Manager.Clients.Profile',
  859. diff --git a/application/site/apps/sr_site_venue_mgr/views/home.py b/application/site/apps/sr_site_venue_mgr/views/home.py
  860. index d08cf0b..d51fc8f 100644
  861. --- a/application/site/apps/sr_site_venue_mgr/views/home.py
  862. +++ b/application/site/apps/sr_site_venue_mgr/views/home.py
  863. @@ -26,6 +26,8 @@ from sr.manager.activitylogmanager import ActivityLogManager
  864. from sr.manager.blackoutdatemanager import BlackoutDateManager
  865. from sr.manager.reservation_type_manager import ReservationTypeManager
  866. from sr.manager.reservationactualviewmanager import ReservationActualViewManager
  867. +from sr.manager.resgroupmanager import ResGroupManager
  868. +from sr.manager.taggroupmanager import TagGroupManager
  869. from sr.manager.venuedatemanager import VenueDateManager
  870. from sr.manager.venuemanager import VenueManager
  871. from sr.manager.venuesettingsmanager import VenueSettingsManager
  872. @@ -869,10 +871,29 @@ def get_seatingareastables(request, venue):
  873. @venue_from_venue_id
  874. @venue_user_only()
  875. def get_tags(request, venue):
  876. + return get_tags_for_domain(request, venue, TagGroupManager.DOMAIN)
  877. +
  878. +
  879. +@do_not_write_session
  880. +@venue_from_venue_id
  881. +@venue_user_only()
  882. +def get_reservation_tags(request, venue):
  883. + return get_tags_for_domain(request, venue, ResGroupManager.DOMAIN)
  884. +
  885. +
  886. +def get_tags_for_domain(request, venue, domain):
  887. current_venue_user = venue_app.get_venue_user(venue, request.user)
  888. can_modify_private_data = feature_app.can_manage_private_data(current_venue_user, request.user)
  889. privacy = 'PUBLIC' if not can_modify_private_data else None
  890. +<<<<<<< Updated upstream
  891. + tag_groups = tags_app.get_tag_groups_for_venue(venue, privacy_filter=privacy)
  892. +=======
  893. +<<<<<<< Updated upstream
  894. tag_groups = tags_app.get_tag_groups_for_entity(venue.venue_group.key(), privacy_filter=privacy)
  895. +=======
  896. + tag_groups = tags_app.get_tag_groups_for_venue(venue, domain=domain, privacy_filter=privacy)
  897. +>>>>>>> Stashed changes
  898. +>>>>>>> Stashed changes
  899. return render_json(context_instance=RequestContext(request),
  900. dictionary={
  901. 'content' : {
  902. @@ -880,7 +901,6 @@ def get_tags(request, venue):
  903. }
  904. })
  905.  
  906. -
  907. @venue_from_venue_id
  908. @venue_user_only()
  909. def save_venue_user_settings(request, venue):
  910. diff --git a/application/site/apps/sr_site_venue_mgr/views/manage.py b/application/site/apps/sr_site_venue_mgr/views/manage.py
  911. index 08c1196..e3cd4e4 100644
  912. --- a/application/site/apps/sr_site_venue_mgr/views/manage.py
  913. +++ b/application/site/apps/sr_site_venue_mgr/views/manage.py
  914. @@ -10,6 +10,16 @@ import gae.blobstore
  915. from gae.shortcuts import get_or_404
  916. from google.appengine.api.blobstore.blobstore import BlobFetchSizeTooLargeError
  917. from google.appengine.ext import db, deferred
  918. +<<<<<<< Updated upstream
  919. +from sr.db.model.taggroup import TagGroup
  920. +=======
  921. +<<<<<<< Updated upstream
  922. +=======
  923. +from sr.db.model.taggroup import TagGroup
  924. +from sr.manager.resgroupmanager import ResGroupManager
  925. +from sr.manager.taggroupmanager import TagGroupManager
  926. +>>>>>>> Stashed changes
  927. +>>>>>>> Stashed changes
  928. from sr.util import location as lutil
  929. from pyclosure.django.shortcuts import render_to_response, redirect, redirect_with_get_params, render_json
  930. from sr.db.model.bottle import Bottle
  931. @@ -1674,7 +1684,17 @@ def view_tags(request, venue):
  932.  
  933. can_modify_private_data = features_app.can_manage_private_data(current_venue_user, request.user)
  934. privacy = 'PUBLIC' if not can_modify_private_data else None
  935. +<<<<<<< Updated upstream
  936. + tag_groups = tags_app.get_tag_groups_for_venue(venue, privacy_filter=privacy)
  937. + tag_group_types = TagGroup.TYPE_CHOICES
  938. +=======
  939. +<<<<<<< Updated upstream
  940. tag_groups = tags_app.get_tag_groups_for_entity(venue.venue_group.key(), privacy_filter=privacy)
  941. +=======
  942. + tag_groups = tags_app.get_tag_groups_for_venue(venue, privacy_filter=privacy)
  943. + tag_group_types = TagGroupManager.TYPE_CHOICES
  944. +>>>>>>> Stashed changes
  945. +>>>>>>> Stashed changes
  946. tags_url = '%s/data/tags' % venue.get_manager_base_url()
  947. venue_settings = VenueSettingsManager.get_or_create(venue)
  948. return render_to_response('Nightloop.Templates.Manager.Manage.Tags',
  949. @@ -1684,8 +1704,10 @@ def view_tags(request, venue):
  950. 'venue' : venue,
  951. 'venue_settings' : venue_settings,
  952. 'content' : {
  953. + 'display': False,
  954. 'error_message': error_message,
  955. 'tag_groups' : tag_groups,
  956. + 'tag_group_types' : tag_group_types,
  957. 'can_manage_private' : can_modify_private_data,
  958. 'venue_group_name' : venue.venue_group.name,
  959. 'tags_url' : tags_url
  960. @@ -1704,18 +1726,44 @@ def view_tags_save(request, venue):
  961.  
  962. if not error_message and request.POST:
  963. can_modify_private_data = features_app.can_manage_private_data(current_venue_user, request.user)
  964. +<<<<<<< Updated upstream
  965. + error_message, should_delete, is_new_group, group_id, category, color, privacy, tag_list, scope, type, disabled = \
  966. + tags_form.process_tag_group_from_post(request.POST)
  967. +
  968. + if not can_modify_private_data and privacy == 'PRIVATE':
  969. + error_message = 'You do not have permissions to create private tags.'
  970. + if not error_message:
  971. + error_message, tag_group = tags_app.create_or_update_tag_group(venue, should_delete, is_new_group, group_id,
  972. + category, color, privacy, tag_list, scope,
  973. + type, disabled)
  974. +=======
  975. +<<<<<<< Updated upstream
  976. error_message, should_delete, is_new_group, group_id, category, color, privacy, tag_list = tags_form.process_tag_group_from_post(request.POST)
  977. if not can_modify_private_data and privacy == 'PRIVATE':
  978. error_message = 'You do not have permissions to create private tags.'
  979. if not error_message:
  980. error_message, tag_group = tags_app.create_or_update_tag_group(venue,should_delete,is_new_group, group_id, category, color, privacy, tag_list)
  981. +=======
  982. + error_message, should_delete, is_new_group, group_id, category, color, privacy, tag_list, \
  983. + scope, type, disabled, tags_type = tags_form.process_tag_group_from_post(request.POST)
  984. +
  985. + domain = ResGroupManager.DOMAIN if tags_type == 'reservation_types' else TagGroupManager.DOMAIN
  986. + if not can_modify_private_data and privacy == 'PRIVATE':
  987. + error_message = 'You do not have permissions to create private tags.'
  988. + if not error_message:
  989. + error_message, tag_group = tags_app.create_or_update_tag_group(venue, should_delete, is_new_group, group_id,
  990. + category, color, privacy, tag_list, scope,
  991. + type, disabled, domain=domain)
  992. +>>>>>>> Stashed changes
  993. +>>>>>>> Stashed changes
  994. if not error_message:
  995. sync.update_sync_data(venue.id, 'TagGroup')
  996. +
  997. return render_json(context_instance=RequestContext(request),
  998. - dictionary={
  999. - 'error' : error_message,
  1000. - 'tag_group' : tag_group
  1001. - })
  1002. + dictionary={
  1003. + 'error': error_message,
  1004. + 'tag_group': tag_group
  1005. + })
  1006.  
  1007. @venue_from_venue_id
  1008. @venue_user_only([VenuePrivilegeLevel.SUPERUSER,VenuePrivilegeLevel.MANAGER])
  1009. diff --git a/application/site/apps/sr_site_venue_mgr/views/manage_rt.py b/application/site/apps/sr_site_venue_mgr/views/manage_rt.py
  1010. index 48240e2..8e3f679 100644
  1011. --- a/application/site/apps/sr_site_venue_mgr/views/manage_rt.py
  1012. +++ b/application/site/apps/sr_site_venue_mgr/views/manage_rt.py
  1013. @@ -2,14 +2,15 @@
  1014. # manage_rt - manage reservation types
  1015.  
  1016. from django.template import RequestContext
  1017. +
  1018. from pyclosure.django.shortcuts import render_to_response
  1019. from sr.db.model.venueuser import VenuePrivilegeLevel
  1020. from sr.manager.reservation_type_manager import ReservationTypeManager
  1021. +from sr.manager.resgroupmanager import ResGroupManager
  1022. from sr.manager.venuesettingsmanager import VenueSettingsManager
  1023. -from sr.app import venue as venue_app, feature as feature_app
  1024. from sr_common.formutil import zip_params, group_by
  1025. from sr_site_venue_mgr.tasks import sync
  1026. -
  1027. +from sr.app import venue as venue_app, feature as features_app, tags as tags_app
  1028. from ..decorators.venue import venue_from_venue_id, venue_user_only
  1029.  
  1030.  
  1031. @@ -30,19 +31,28 @@ def view_edit_reservation_types(request, venue):
  1032. message = 'Changes saved'
  1033. sync.update_sync_data(venue.id, 'ReservationType')
  1034.  
  1035. - types = ReservationTypeManager.as_select_options(venue, include_blank=False)
  1036. current_venue_user = venue_app.get_venue_user(venue, request.user)
  1037. + can_modify_private_data = features_app.can_manage_private_data(current_venue_user, request.user)
  1038. + privacy = 'PUBLIC' if not can_modify_private_data else None
  1039. + tag_groups = tags_app.get_tag_groups_for_venue(venue, domain='ReservationActual', privacy_filter=privacy)
  1040. + tag_group_types = ResGroupManager.TYPE_CHOICES
  1041. + reservation_tags_url = '%s/data/reservationtags' % venue.get_manager_base_url()
  1042.  
  1043. - return render_to_response('Nightloop.Templates.Manager.Manage.ReservationTypes.Edit',
  1044. + return render_to_response('Nightloop.Templates.Manager.Manage.Tags',
  1045. context_instance=RequestContext(request),
  1046. dictionary=dict(
  1047. navigation='settings',
  1048. venue=venue,
  1049. + identifier='reservation_types',
  1050. + label='Reservation Code',
  1051. venue_settings=VenueSettingsManager.get_or_create(venue),
  1052. content=dict(
  1053. + display=False,
  1054. message=message,
  1055. - reservation_types=types,
  1056. - venue_has_floorplan=venue_app.has_floorplan(venue),
  1057. - can_view_floorplan=feature_app.can_view_floorplan(current_venue_user, request.user),
  1058. + tag_groups=tag_groups,
  1059. + tag_group_types=tag_group_types,
  1060. + can_manage_private=can_modify_private_data,
  1061. + venue_group_name=venue.venue_group.name,
  1062. + reservation_tags_url=reservation_tags_url
  1063. )
  1064. - ))
  1065. + ))
  1066. \ No newline at end of file
  1067. diff --git a/application/site/apps/sr_site_venue_mgr/views/reservation.py b/application/site/apps/sr_site_venue_mgr/views/reservation.py
  1068. index 221f8ce..3bebbd3 100644
  1069. --- a/application/site/apps/sr_site_venue_mgr/views/reservation.py
  1070. +++ b/application/site/apps/sr_site_venue_mgr/views/reservation.py
  1071. @@ -614,7 +614,7 @@ def view_actual_details_popup(request, venue, venue_privilege_level, actual):
  1072. properties=('name_display', 'phone_number', 'phone_number_formatted', 'phone_number_locale', 'phone_number_alt_formatted', 'phone_number_alt_locale','email_address', 'gender_display',
  1073. 'total_spend_formatted_no_decimals', 'total_visits', 'avg_rating_formatted', 'address_formatted', 'address', 'address_2',
  1074. 'notes', 'first_name', 'last_name', 'title','company','title_company_display','status_display', 'name_only_display', 'gender', 'status',
  1075. - 'birthday_display', 'birthday_day', 'birthday_month', 'tags_display', 'tags_group_display', 'is_contact_private',
  1076. + 'birthday_display', 'birthday_day', 'birthday_month', 'tags_display', 'is_contact_private',
  1077. 'is_email_address_viewable', 'is_email_address_editable', 'is_phone_viewable', 'is_phone_editable', 'is_address_editable',
  1078. 'city_display', 'state_display', 'country_display', 'postal_code_display', 'is_phone_alt_viewable', 'is_phone_alt_editable',
  1079. 'is_city_editable', 'is_state_editable', 'is_postal_code_editable', 'is_country_editable', 'created_by_display',
  1080. @@ -625,6 +625,7 @@ def view_actual_details_popup(request, venue, venue_privilege_level, actual):
  1081. 'can_view_all_contact_info':can_view_all_contact_info,
  1082. 'current_user_id':request.user.id})
  1083.  
  1084. + venue_group_client.add_property('tags_group_display', actual.venue_group_client.get_tags_group_display_by_venue(venue))
  1085. actual = create_render_models(actual, with_locale=venue.get_locale(), convert_to_currency=venue.get_currency_code(),
  1086. properties=('client_name_first_first_display',
  1087. 'bookedby_alt_view', 'bookedby_view', 'date_formatted_short', 'transaction_type',
  1088. diff --git a/application/site/static/css/manager/components.styl b/application/site/static/css/manager/components.styl
  1089. index 1c4cd4b..018404c 100644
  1090. --- a/application/site/static/css/manager/components.styl
  1091. +++ b/application/site/static/css/manager/components.styl
  1092. @@ -940,7 +940,6 @@ p.chatting
  1093. margin 2px
  1094. overflow hidden
  1095. .tag-name
  1096. - font-weight bold
  1097. padding-right 6px
  1098. padding-left 5px
  1099. .tag-item-color
  1100. @@ -964,17 +963,63 @@ p.chatting
  1101. z-index 20
  1102.  
  1103. .tag-editor
  1104. + .relative-container
  1105. + position absolute
  1106. + .new
  1107. + font-weight bold
  1108. + .tag-table-container.new-style
  1109. + .color
  1110. + display block
  1111. + width 10px
  1112. + height 10px
  1113. + border-radius 5px
  1114. + margin 3px 3px 0px 0px
  1115. + height 200px
  1116. + overflow scroll
  1117. + width 200px
  1118. + .tag-item-container
  1119. + padding 0px 5px
  1120. + float none
  1121. + .tag-item
  1122. + .tag-item-color
  1123. + background-color: #FFFFFF !important
  1124. + .tag-item:hover
  1125. + background-color #EEEEEE !important
  1126. + .tag-group-display-container
  1127. + min-height 200px
  1128. h3
  1129. color #aaa
  1130. font bold 12px $Lato
  1131. margin 10px 0
  1132. + .tag-area-css
  1133. + .tag-item
  1134. + background-color #FFF
  1135. + .close-tag
  1136. + color: #FFF
  1137. + .tag-item.hover
  1138. + background-color #EEE
  1139. + .close-tag
  1140. + color: #999
  1141. .tag-table-category
  1142. .tags-group-category
  1143. color #999
  1144. font-weight bold
  1145. margin 5px 0
  1146. + span
  1147. + width 10px
  1148. + height 10px
  1149. + radius(5px)
  1150. + margin 3px 3px 0 0
  1151. + display block
  1152. + .tag-group-name
  1153. + margin-left 5px
  1154.  
  1155. +#find-tags-input
  1156. + width 194px
  1157. #find-tags-results
  1158. + width 200px
  1159. + -ms-text-overflow: ellipsis
  1160. + text-overflow: ellipsis
  1161. radius(3px)
  1162. shadow(2px)
  1163. background white
  1164. diff --git a/application/site/static/css/manager/page/clients-profile.styl b/application/site/static/css/manager/page/clients-profile.styl
  1165. index c659ed5..4f6f100 100644
  1166. --- a/application/site/static/css/manager/page/clients-profile.styl
  1167. +++ b/application/site/static/css/manager/page/clients-profile.styl
  1168. @@ -20,8 +20,8 @@
  1169.  
  1170. #basics
  1171. background #d7e6ff
  1172. - padding 20px 20px 20px 20px
  1173. - width 185px
  1174. + padding 2%
  1175. + width 20%
  1176. h3
  1177. font bold 14px $Lato
  1178. margin 20px 0
  1179. @@ -68,7 +68,8 @@
  1180.  
  1181.  
  1182. #activity-area
  1183. - padding 15px 15px 100px
  1184. + width 50%
  1185. + padding 1% 1% 5%
  1186. h3.company
  1187. h3.location
  1188. font-size 18px
  1189. @@ -139,7 +140,7 @@
  1190. #stats-area
  1191. freeshadow(inset 2px 0px 1px 0px rgba(216,216,216,1))
  1192. background #f4f4f4
  1193. - width 324px
  1194. + width 30%
  1195. div.header
  1196. freeshadow(inset 2px 0px 1px 0px rgba(216,216,216,1))
  1197. background #d7e6ff
  1198. @@ -150,14 +151,30 @@
  1199. text-align center
  1200. text-transform uppercase
  1201. .stat-group
  1202. + width 100%
  1203. border-bottom 1px dotted $light_divide
  1204. clear both
  1205. float left
  1206. p
  1207. float left
  1208. - padding 10px 4px
  1209. + padding 2% 1%
  1210. text-align center
  1211. - width 100px
  1212. + width 30%
  1213. + .tags-icon
  1214. + border-right 1px dotted #e1e1e1
  1215. + img
  1216. + height 30px
  1217. + .tags-list span
  1218. + color black
  1219. + &.service
  1220. + width 100%
  1221. + padding 10px
  1222. + tr
  1223. + border-bottom 1px dotted #e1e1e1
  1224. + table
  1225. + border-top 1px dotted #e1e1e1
  1226. + td
  1227. + border 0px
  1228. strong, span
  1229. display block
  1230. strong
  1231. diff --git a/application/site/static/css/manager/page/manage-tags.styl b/application/site/static/css/manager/page/manage-tags.styl
  1232. index a34b701..9ace392 100644
  1233. --- a/application/site/static/css/manager/page/manage-tags.styl
  1234. +++ b/application/site/static/css/manager/page/manage-tags.styl
  1235. @@ -3,7 +3,10 @@
  1236. float left
  1237. font-size 14px
  1238. margin 20px 10px
  1239. -
  1240. + .styled
  1241. + padding 5px
  1242. + border 1px solid #DEDEDE
  1243. + margin-bottom 10px
  1244. h3
  1245. border-bottom 1px solid $light_divide
  1246. font bold 16px $Lato
  1247. @@ -61,10 +64,24 @@ p.description
  1248. clear both
  1249. float left
  1250.  
  1251. -.category-name-header
  1252. - cursor move
  1253. - font bold 16px $Lato
  1254. - margin-top 10px
  1255. +.category-header
  1256. + .category-name-header
  1257. + cursor move
  1258. + font bold 16px $Lato
  1259. + margin-top 10px
  1260. + float left
  1261. + clear none !important
  1262. + .enable-header
  1263. + float right
  1264. + clear none
  1265. + width 60px
  1266. + height 30px
  1267. + margin-top 8px
  1268. + cursor pointer
  1269. + background url('{$MEDIA_URL}images/off-switch.png')
  1270. + &.on
  1271. + width 55px
  1272. + background: url('{$MEDIA_URL}images/on-switch.png')
  1273.  
  1274. .tag-group-colorpicker
  1275. width 40px
  1276. @@ -82,7 +99,9 @@ p.description
  1277. margin-top 5px
  1278. padding 0 20px
  1279.  
  1280. -.tag-group-privacy
  1281. +.tag-group-privacy,
  1282. +.tag-group-scope,
  1283. +.tag-group-type
  1284. padding 5px 0.5em 7px !important
  1285.  
  1286. .tag-group-add p.button
  1287. @@ -108,11 +127,14 @@ div.tag-group-add
  1288. padding 0 10px
  1289. width 40px
  1290.  
  1291. -.form-element.privacy
  1292. - p.input
  1293. - width 100px !important
  1294. - .downer
  1295. - top 13px !important
  1296. +.form-element
  1297. + &.privacy,
  1298. + &.level,
  1299. + &.type
  1300. + p.input
  1301. + width 100px !important
  1302. + .downer
  1303. + top 13px !important
  1304.  
  1305. .tag-display
  1306. clear both
  1307. diff --git a/application/site/static/css/nightloop.manager.settings.styl b/application/site/static/css/nightloop.manager.settings.styl
  1308. index f91554b..6b59eed 100644
  1309. --- a/application/site/static/css/nightloop.manager.settings.styl
  1310. +++ b/application/site/static/css/nightloop.manager.settings.styl
  1311. @@ -161,7 +161,7 @@
  1312. @import "manager/page/clients-merge"
  1313.  
  1314. #page-clientsprofile
  1315. - min-width 1192px
  1316. + min-width 800px
  1317. @import "manager/page/clients-profile"
  1318. @import "manager/page/photo-editor"
  1319.  
  1320. diff --git a/application/site/static/css/nightloop.mobile.styl b/application/site/static/css/nightloop.mobile.styl
  1321. index f380104..79898a1 100644
  1322. --- a/application/site/static/css/nightloop.mobile.styl
  1323. +++ b/application/site/static/css/nightloop.mobile.styl
  1324. @@ -1873,8 +1873,13 @@ body #manager
  1325. #stats-area
  1326. float left
  1327. width 100% !important
  1328. - .stat-group p
  1329. - width 98px
  1330. + .stat-group
  1331. + p
  1332. + width 98px
  1333. + img
  1334. + height 30px
  1335. + .tags-list
  1336. + padding-top 20px
  1337.  
  1338. #basics div.thumb
  1339. left 50%
  1340. diff --git a/application/site/static/images/tags/allergy.png b/application/site/static/images/tags/allergy.png
  1341. new file mode 100644
  1342. index 0000000..17b36b2
  1343. Binary files /dev/null and b/application/site/static/images/tags/allergy.png differ
  1344. diff --git a/application/site/static/js/page/common/common.tagcache.js b/application/site/static/js/page/common/common.tagcache.js
  1345. index 63ea3bb..c5e8c2c 100644
  1346. --- a/application/site/static/js/page/common/common.tagcache.js
  1347. +++ b/application/site/static/js/page/common/common.tagcache.js
  1348. @@ -19,7 +19,7 @@ Pmp.Common.TagCache = {
  1349. self.renderTags();
  1350. }
  1351. if (the_call_back) {
  1352. - the_call_back();
  1353. + the_call_back(content);
  1354. }
  1355. });
  1356. },
  1357. @@ -46,7 +46,20 @@ Pmp.Common.TagCache = {
  1358.  
  1359. renderTags : function() {
  1360. var self = this;
  1361. + $('.tags-group.new-style').each(function (e, obj){
  1362. + var tag_group_id = $(obj).find('.tag-group-id').val(),
  1363. + tag_group_obj = self._findTagGroupById(tag_group_id),
  1364. + bg_color_hex = tag_group_obj.color_hex;
  1365. + $(obj).find('.tags-group-category span').css({'background-color':bg_color_hex});
  1366. + });
  1367. +
  1368. $('.tag-item').each(function(e,obj){
  1369. + $(this).on('mouseover', function(event) {
  1370. + $(this).addClass('hover')
  1371. + });
  1372. + $(this).on('mouseout', function(event) {
  1373. + $(this).removeClass('hover')
  1374. + });
  1375. var tag_group_id = $(obj).find('.tag-group-id').val();
  1376. if (tag_group_id == '') {
  1377. tag_group_id = $(obj).find('.tag-group-id').html();
  1378. diff --git a/application/site/static/js/page/manager/manager.clients.profile.js b/application/site/static/js/page/manager/manager.clients.profile.js
  1379. index 1f7c32c..aeb186d 100644
  1380. --- a/application/site/static/js/page/manager/manager.clients.profile.js
  1381. +++ b/application/site/static/js/page/manager/manager.clients.profile.js
  1382. @@ -140,42 +140,6 @@ Pmp.Manager.Clients.Profile = {
  1383. Pmp.Utils.AddDropdown('#delete-client-btn', '#contextual-content-cannot-delete-client');
  1384. }
  1385.  
  1386. - var findtagsinput = $('#find-tags-input');
  1387. - findtagsinput.keyup(function(ev) {
  1388. - if ((ev.which == 37) || (ev.which == 38)) {
  1389. - // left/up
  1390. - self._onFindTagsPressUp();
  1391. - ev.preventDefault();
  1392. - } else if ((ev.which == 39) || (ev.which == 40)){
  1393. - // right/down
  1394. - self._onFindTagsPressDown();
  1395. - ev.preventDefault();
  1396. - } else if (ev.which == 13) {
  1397. - // enter
  1398. - self._onFindTagsPressEnter();
  1399. - ev.preventDefault();
  1400. - } else if (ev.which == 8) {
  1401. - self._onFindTagsInputKeypress(this);
  1402. - if (findtagsinput.val().length == 0) {
  1403. - var lastTag = $('.find-tags-container').find('.tag-item-container').last();
  1404. - if (lastTag.length) {
  1405. - lastTag.fadeOut('slow').remove();
  1406. - }
  1407. - }
  1408. - } else {
  1409. - self._onFindTagsInputKeypress(this);
  1410. - }
  1411. - });
  1412. - //findtagsinput.blur(function() { $('#find-tags-results').hide(); });
  1413. - findtagsinput.click(function() { self._onFindTagsInputKeypress(this); });
  1414. - page.AddLiveHandler('#find-tags-results .tag-item-container', 'mousedown', function(event) {
  1415. - self._onAddTagToSearch(this);
  1416. - $('#find-tags-results').hide();
  1417. - });
  1418. -
  1419. - var onClickDocumentHideTagsPicker = function(event) {self._hideTagsPicker(event); };
  1420. - $(document).mouseup(onClickDocumentHideTagsPicker);
  1421. -
  1422. },
  1423.  
  1424. _loadCards : function() {
  1425. @@ -229,6 +193,7 @@ Pmp.Manager.Clients.Profile = {
  1426. $('#membership-block').prepend(html);
  1427. },
  1428.  
  1429. +<<<<<<< Updated upstream
  1430. _hideTagsPicker : function(e) {
  1431. var container = $('#find-tags-results');
  1432. if (container.has(e.target).length === 0)
  1433. @@ -253,6 +218,8 @@ Pmp.Manager.Clients.Profile = {
  1434. }
  1435.  
  1436. var html = Nightloop.Templates.Widget.Tag({
  1437. + 'is_new_style': true,
  1438. + 'newly_added': true,
  1439. 'tag_name' : tag_name,
  1440. 'tag_group_id' : tag_group_id,
  1441. 'tag_group_name' : tag_group_name,
  1442. @@ -260,10 +227,10 @@ Pmp.Manager.Clients.Profile = {
  1443. 'is_private' : privacy.toUpperCase() == 'PRIVATE',
  1444. 'close_func' : 'Pmp.Manager.Search.Page.onCloseTag(this)'
  1445. });
  1446. -
  1447. +
  1448. // find category it belongs to and add after last one
  1449. var added = false;
  1450. -
  1451. +
  1452. $('.tags-group', '.tag-area-edit').each(function(idx,el) {
  1453. if ($(el).attr('tag_group_id') === tag_group_id) {
  1454. // found the group
  1455. @@ -273,6 +240,14 @@ Pmp.Manager.Clients.Profile = {
  1456. } else {
  1457. $(html).insertBefore($('.insert-tags-here', $(el)));
  1458. }
  1459. + // Bind events
  1460. + $(html).find('.tag-item').on('mouseover', function(event) {
  1461. + $(this).addClass('hover')
  1462. + });
  1463. + $(html).find('.tag-item').on('mouseout', function(event) {
  1464. + $(this).removeClass('hover')
  1465. + });
  1466. +
  1467. added = true;
  1468. return false;
  1469. }
  1470. @@ -289,11 +264,15 @@ Pmp.Manager.Clients.Profile = {
  1471. 'is_private' : privacy.toUpperCase() == 'PRIVATE',
  1472. 'tags' : [{
  1473. 'tag_name' : tag_name,
  1474. + 'is_new_style': true,
  1475. + 'newly_added': true,
  1476. 'tag_group_id' : tag_group_id,
  1477. 'tag_group_name' : tag_group_name,
  1478. 'is_private' : privacy.toUpperCase() == 'PRIVATE'
  1479. }]
  1480. },
  1481. + 'is_new_style': true,
  1482. + 'color_hex': tag_group_color,
  1483. 'can_view_private' : true, // doesn't matter
  1484. 'close_func' : 'Pmp.Manager.Search.Page.onCloseTag(this)'
  1485. });
  1486. @@ -304,13 +283,18 @@ Pmp.Manager.Clients.Profile = {
  1487. 'name' : tag_group_name,
  1488. 'id' : tag_group_id,
  1489. 'is_private' : privacy.toUpperCase() == 'PRIVATE',
  1490. + 'is_new_style': true,
  1491. + 'color_hex': tag_group_color,
  1492. 'tags' : [{
  1493. 'tag_name' : tag_name,
  1494. 'tag_group_id' : tag_group_id,
  1495. + 'is_new_style': true,
  1496. + 'newly_added': true,
  1497. 'tag_group_name' : tag_group_name,
  1498. 'is_private' : privacy.toUpperCase() == 'PRIVATE'
  1499. }]
  1500. }],
  1501. + 'is_new_style': true,
  1502. 'can_view_private' : true, // doesn't matter
  1503. 'close_func' : 'Pmp.Manager.Search.Page.onCloseTag(this)'
  1504. });
  1505. @@ -398,6 +382,8 @@ Pmp.Manager.Clients.Profile = {
  1506. tags.filter(':visible').first().addClass('selected');
  1507. },
  1508.  
  1509. +=======
  1510. +>>>>>>> Stashed changes
  1511. _adjustBoxHeight : function() {
  1512. // make sure menu is the same height for both halves
  1513. var client_info = $('.client-info-box', '#profile-summary-pane');
  1514. diff --git a/application/site/static/js/page/manager/manager.manage.tags.js b/application/site/static/js/page/manager/manager.manage.tags.js
  1515. index 29ad4a0..114256a 100644
  1516. --- a/application/site/static/js/page/manager/manager.manage.tags.js
  1517. +++ b/application/site/static/js/page/manager/manager.manage.tags.js
  1518. @@ -3,10 +3,11 @@ Pmp.Manager = Pmp.Manager || {};
  1519. Pmp.Manager.Manage = Pmp.Manager.Manage || {};
  1520.  
  1521. Pmp.Manager.Manage.Tags = {
  1522. - initialize : function(manager_base_url, media_url, can_manage_private_data) {
  1523. + initialize : function(manager_base_url, media_url, can_manage_private_data, tags_type) {
  1524. this._manager_base_url = manager_base_url;
  1525. this._media_url = media_url;
  1526. this._can_manage_private_data = can_manage_private_data;
  1527. + this._tags_type = tags_type;
  1528.  
  1529. var self = this;
  1530. var destroyerFn = function() { self.destroy(); };
  1531. @@ -65,6 +66,16 @@ Pmp.Manager.Manage.Tags = {
  1532. self._makeTagGroupEditMode(tag_group);
  1533. });
  1534.  
  1535. + page.AddLiveHandler('.enable-header', 'mousedown', _.bind(function(e) {
  1536. + var currElement = $(e.currentTarget),
  1537. + tagBlock = $(currElement).closest('.tag-group-block'),
  1538. + tag_group_id = tagBlock.find('.tag-group-id').val();
  1539. + $(currElement).toggleClass('on');
  1540. + tagBlock.find('.tag-group-tags')
  1541. + .toggleClass('no-display', !$(currElement).hasClass('on'));
  1542. + this.disableCategoryId(tag_group_id, !$(currElement).hasClass('on'));
  1543. + }, this));
  1544. +
  1545. page.AddLiveHandler('.cancel-link', 'click', function(e) {
  1546. var tag_group = $(this).parents('.tag-group-block');
  1547. var group_id = tag_group.find('.tag-group-id').val();
  1548. @@ -122,7 +133,8 @@ Pmp.Manager.Manage.Tags = {
  1549. tag_group_order[tag_group_id] = idx;
  1550. });
  1551. var post_dict = {
  1552. - 'tag_group_order' : JSON.stringify(tag_group_order)
  1553. + 'tag_group_order' : JSON.stringify(tag_group_order),
  1554. + tags_type: this._tags_type
  1555. }
  1556. var baseUrl = this._manager_base_url;
  1557. var url = baseUrl + '/manage/tags/order/save';
  1558. @@ -237,6 +249,7 @@ Pmp.Manager.Manage.Tags = {
  1559. var self = this;
  1560. var html = Nightloop.Templates.Manager.Manage.TagGroup({'MEDIA_URL': this._media_url, 'can_manage_private': this._can_manage_private_data});
  1561. var new_category = $(html).insertBefore('#insert-tag-groups-here');
  1562. + $('body').animate({scrollTop: $(new_category).offset().top});
  1563.  
  1564. // bind color picker
  1565. self._bindColorPicker(new_category);
  1566. @@ -272,7 +285,7 @@ Pmp.Manager.Manage.Tags = {
  1567. var category_color = $(tag_group).find('.tag-group-colorpicker-val').val();
  1568. var privacy = $(tag_group).find('.tag-group-privacy').val();
  1569. valid = (category_name.length > 0) && valid;
  1570. - valid = ((privacy == 'PUBLIC') || (privacy == 'PRIVATE')) && valid;
  1571. + valid = (!privacy || privacy == 'PUBLIC' || privacy == 'PRIVATE') && valid;
  1572. if (!valid) {
  1573. $(tag_group).find('.error-message-area').html('Please enter a category name.');
  1574. Pmp.Utils.GoldButtonReset($(tag_group).find('.save-tag-group-btn'));
  1575. @@ -283,10 +296,12 @@ Pmp.Manager.Manage.Tags = {
  1576. },
  1577.  
  1578. deleteCategory: function(el) {
  1579. - var tag_group = $(el).parents('.tag-group-block');
  1580. - var tag_group_id = $(tag_group).find('.tag-group-id').val();
  1581. + var tag_group = $(el).parents('.tag-group-block'),
  1582. + tag_group_id = $(tag_group).find('.tag-group-id').val();
  1583. +
  1584. if (tag_group_id.length > 0) {
  1585. var post_dict = {
  1586. + tags_type: this._tags_type,
  1587. 'tag_group_id' : tag_group_id,
  1588. 'delete' : true
  1589. }
  1590. @@ -306,6 +321,30 @@ Pmp.Manager.Manage.Tags = {
  1591. }
  1592. },
  1593.  
  1594. +<<<<<<< Updated upstream
  1595. + disableCategoryId: function(tag_group_id, disable) {
  1596. + var post_dict = {
  1597. + 'tag_group_id' : tag_group_id,
  1598. + 'disabled' : Number(disable)
  1599. +=======
  1600. +<<<<<<< Updated upstream
  1601. +=======
  1602. + disableCategoryId: function(tag_group_id, disable) {
  1603. + var post_dict = {
  1604. + 'tag_group_id' : tag_group_id,
  1605. + 'disabled' : Number(disable),
  1606. + tags_type: this._tags_type
  1607. +>>>>>>> Stashed changes
  1608. + },
  1609. + baseUrl = this._manager_base_url,
  1610. + url = baseUrl + '/manage/tags/save';
  1611. + Pmp.Client.LoadAjaxData(url, post_dict, true, $.noop);
  1612. + },
  1613. +
  1614. +<<<<<<< Updated upstream
  1615. +=======
  1616. +>>>>>>> Stashed changes
  1617. +>>>>>>> Stashed changes
  1618. submitTagGroup: function(tag_group) {
  1619. var self = this;
  1620. var sort_order = 'asc';
  1621. @@ -331,6 +370,9 @@ Pmp.Manager.Manage.Tags = {
  1622. $(tag_group).find('.tag-name-input').each(function(idx,el){
  1623. tags.push($(el).val());
  1624. });
  1625. +<<<<<<< Updated upstream
  1626. +=======
  1627. +<<<<<<< Updated upstream
  1628. var category_name = $(tag_group).find('.tag-group-category-name').val();
  1629. var privacy = $(tag_group).find('.tag-group-privacy').val();
  1630. var post_dict = {
  1631. @@ -339,6 +381,26 @@ Pmp.Manager.Manage.Tags = {
  1632. 'color' : $(tag_group).find('.tag-group-colorpicker-val').val(),
  1633. 'privacy' : privacy,
  1634. 'tags' : tags
  1635. +=======
  1636. +>>>>>>> Stashed changes
  1637. + var category_name = $(tag_group).find('.tag-group-category-name').val(),
  1638. + privacy = $(tag_group).find('.tag-group-privacy').val(),
  1639. + scope = $(tag_group).find('.tag-group-scope').val(),
  1640. + type = $(tag_group).find('.tag-group-type').val(),
  1641. + post_dict = {
  1642. + 'tag_group_id' : $(tag_group).find('.tag-group-id').val(),
  1643. + 'category_name' : category_name,
  1644. + 'color' : $(tag_group).find('.tag-group-colorpicker-val').val(),
  1645. + 'privacy' : privacy,
  1646. + 'tags' : tags,
  1647. + 'scope': scope,
  1648. +<<<<<<< Updated upstream
  1649. + 'type': type
  1650. +=======
  1651. + 'type': type,
  1652. + tags_type: this._tags_type
  1653. +>>>>>>> Stashed changes
  1654. +>>>>>>> Stashed changes
  1655. }
  1656. var baseUrl = this._manager_base_url;
  1657. var url = baseUrl + '/manage/tags/save';
  1658. @@ -346,9 +408,12 @@ Pmp.Manager.Manage.Tags = {
  1659. if (data.payload.error) {
  1660. $(tag_group).find('.error-message-area').html(data.payload.error);
  1661. } else {
  1662. - var private_add = (privacy.toUpperCase() == 'PRIVATE') ? ' (private)' : '';
  1663. - $(tag_group).find('.category-name-header').html(category_name + private_add);
  1664. + var private_add = (privacy.toUpperCase() == 'PRIVATE') ? ' (private)' : '',
  1665. + global_add = data.payload.tag_group.is_global ? ' (Global)' : '';
  1666. + $(tag_group).find('.category-name-header').html(category_name + global_add + private_add);
  1667. $(tag_group).find('.tag-group-id').val(data.payload.tag_group.id);
  1668. + $(tag_group).closest('form').toggleClass('global', data.payload.tag_group.is_global);
  1669. + $(tag_group).closest('form').find('.form-element.level').toggleClass('no-display', data.payload.tag_group.is_global);
  1670. self._makeTagGroupViewMode($(tag_group));
  1671. self._setRevertColor($(tag_group));
  1672. $('.tag-item-container', tag_group).tsort({attr:'sort_tag_name', order:sort_order, sortFunction:sort_fn});
  1673. diff --git a/application/site/static/js/page/manager/manager.reservation.book.js b/application/site/static/js/page/manager/manager.reservation.book.js
  1674. index 42027bb..3e6e24e 100644
  1675. --- a/application/site/static/js/page/manager/manager.reservation.book.js
  1676. +++ b/application/site/static/js/page/manager/manager.reservation.book.js
  1677. @@ -180,8 +180,8 @@ Pmp.Manager.Reservation.Book = {
  1678. $('#input-phone').change(changeClientProfileSearchFn);
  1679. $('#input-email').keyup(changeClientProfileSearchFn);
  1680. $('#input-email').change(changeClientProfileSearchFn);
  1681. - $('#reservation-type-select').change(function() { self._changeReservationTypeSelect(); });
  1682. -
  1683. + //$('#reservation-type-select').change(function() { self._changeReservationTypeSelect(); });
  1684. +
  1685. // comp and nomin replacements
  1686. $('#id_comp_table, #id_nomin_table').on('click', function() {
  1687. $('#min-price-override').val('');
  1688. diff --git a/application/site/static/js/page/manager/manager.tags.lookup.js b/application/site/static/js/page/manager/manager.tags.lookup.js
  1689. new file mode 100644
  1690. index 0000000..2a9ab37
  1691. --- /dev/null
  1692. +++ b/application/site/static/js/page/manager/manager.tags.lookup.js
  1693. @@ -0,0 +1,358 @@
  1694. +/**
  1695. + * Created by krunal on 9/1/15.
  1696. + */
  1697. +var Pmp = Pmp || {};
  1698. +Pmp.Manager = Pmp.Manager || {};
  1699. +Pmp.Manager.Tags = Pmp.Manager.Tags || {};
  1700. +Pmp.Manager.Tags.Lookup = {
  1701. + initialize: function (tag_groups,
  1702. + container_div,
  1703. + tags_input_identifier,
  1704. + tags_results_identifier,
  1705. + tags_input_parent_identifier,
  1706. + tag_item_identifier,
  1707. + tag_table_identifier,
  1708. + tag_table_group_identifier) {
  1709. + debugger;
  1710. + this._container_div = container_div;
  1711. + this._tags_input = this._container_div.find(tags_input_identifier);
  1712. + this._tags_results = this._container_div.find(tags_results_identifier);
  1713. + this._tags_input_parent = this._container_div.find(tags_input_parent_identifier);
  1714. + this._tag_item_identifier = tag_item_identifier;
  1715. + this._tag_table_identifier = tag_table_identifier;
  1716. + this._tag_table_group_identifier = tag_table_group_identifier;
  1717. + this._tags_group = '.tags-group';
  1718. + this._tag_group_id = '.tag-group-id';
  1719. + this._tag_area = '.tag-area';
  1720. + this._tag_item = '.tag-item';
  1721. + this._tag_area_edit = '.tag-area-edit';
  1722. + this._insert_tag_area = '.insert-tags-here';
  1723. + this._tag_item_color_identifier = '.tag-item-color';
  1724. + this._privacy = '.privacy';
  1725. + this._tag_name = '.tag-name';
  1726. + this._tags_group_category_identifier = '.tags-group-category';
  1727. + this._tag_groups = tag_groups;
  1728. + },
  1729. +
  1730. + bindEvents: function () {
  1731. + this._tags_input.on('keyup', {}, _.bind(function (ev) {
  1732. + if ((ev.which == 37) || (ev.which == 38)) { // left/up
  1733. + this._onFindTagsPressUp();
  1734. + } else if ((ev.which == 39) || (ev.which == 40)) { // right/down
  1735. + this._onFindTagsPressDown();
  1736. + } else if (ev.which == 13) { // enter
  1737. + this._onFindTagsPressEnter();
  1738. + } else if (ev.which == 8) {
  1739. + this._onFindTagsInputKeypress(ev.currentTarget);
  1740. + if (this._tags_input.val().length == 0) {
  1741. + var lastTag = this._container_div.find(this._tags_input_parent).find(this._tag_item_identifier).last();
  1742. + if (lastTag.length) {
  1743. + lastTag.fadeOut('slow').remove();
  1744. + }
  1745. + }
  1746. + } else {
  1747. + this._onFindTagsInputKeypress(ev.currentTarget);
  1748. + }
  1749. + ev.preventDefault();
  1750. + }, this));
  1751. +
  1752. + this._tags_input.on('click', {},
  1753. + _.bind(function (ev) {
  1754. + this._onFindTagsInputKeypress(ev.currentTarget)
  1755. + }, this)
  1756. + );
  1757. +
  1758. + this._tags_results.find(this._tag_item_identifier).on('mousedown', {}, _.bind(function (ev) {
  1759. + this._onAddTagToSearch(ev.currentTarget);
  1760. + this._tags_results.hide();
  1761. + }, this));
  1762. +
  1763. + $(document).on('mouseup', {}, _.bind(function(ev) {
  1764. + this._hideTagsPicker(ev.currentTarget);
  1765. + }, this));
  1766. + },
  1767. +
  1768. + _onFindTagsPressUp: function () {
  1769. + var selected = this._container_div.find(this._tag_table_identifier).find(this._tag_item_identifier).find('.selected'),
  1770. + all_visible = this._container_div.find(this._tag_table_identifier).find(this._tag_item_identifier).filter(':visible'),
  1771. + idx = all_visible.index(selected);
  1772. +
  1773. + if ((idx - 1) >= 0) {
  1774. + var new_selected = all_visible.get(idx - 1);
  1775. + if ($(new_selected).length > 0) {
  1776. + $(new_selected).addClass('selected');
  1777. + $(selected).removeClass('selected');
  1778. + }
  1779. + }
  1780. + },
  1781. +
  1782. + _onFindTagsPressDown: function () {
  1783. + var selected = this._container_div.find(this._tag_table_identifier).find(this._tag_item_identifier).find('.selected'),
  1784. + all_visible = this._container_div.find(this._tag_table_identifier).find(this._tag_item_identifier).filter(':visible'),
  1785. + idx = all_visible.index(selected);
  1786. +
  1787. + if ((idx + 1) < all_visible.length) {
  1788. + var new_selected = all_visible.get(idx + 1);
  1789. + if ($(new_selected).length > 0) {
  1790. + $(new_selected).addClass('selected');
  1791. + $(selected).removeClass('selected');
  1792. + }
  1793. + }
  1794. + },
  1795. +
  1796. + _onFindTagsPressEnter: function () {
  1797. + this._container_div.find(this._tag_table_identifier).find(this._tag_item_identifier).find('.selected').mousedown();
  1798. + },
  1799. +
  1800. + search : function(search_str) {
  1801. + var results = [];
  1802. + for (var i=0; i < this._tag_groups.length; i++) {
  1803. + var tag_group = this._tag_groups[i];
  1804. + for (var j=0; j < tag_group.tags.length; j++) {
  1805. + var tag_name = tag_group.tags[j];
  1806. + if (this._startsWith(search_str.toLowerCase(), tag_name.toLowerCase())) {
  1807. + results.push({
  1808. + 'tag_name' : tag_name,
  1809. + 'tag_group_name' : tag_group.name,
  1810. + 'tag_group_id' : tag_group.id,
  1811. + 'privacy' : tag_group.privacy,
  1812. + 'color_hex' : tag_group.color_hex
  1813. + });
  1814. + }
  1815. + }
  1816. + }
  1817. + return results;
  1818. + },
  1819. +
  1820. + _onFindTagsInputKeypress: function (el) {
  1821. + var searchStr = $(el).val(),
  1822. + resultsDom = this._tags_results,
  1823. + results = this.search(searchStr);
  1824. +
  1825. + this._toggle_tags_display(!Boolean(searchStr.length));
  1826. +
  1827. + for (var i = 0; i < results.length; i++) {
  1828. + var tag_name = results[i].tag_name,
  1829. + tag_group_id = results[i].tag_group_id,
  1830. + privacy = results[i].privacy,
  1831. + hash = privacy + '##' + tag_group_id + '##' + tag_name;
  1832. +
  1833. + this._container_div.find('.tag-group-id-name-hash' + ',' + this._tag_item_identifier).each(function (idx, el) {
  1834. + if ($(el).html() == hash) {
  1835. + $(el).parents(this._tag_table_group_identifier).show();
  1836. + $(el).parents(this._tag_item_identifier).show();
  1837. + return false;
  1838. + }
  1839. + });
  1840. + }
  1841. + var tags = this._container_div.find(this._tag_item_identifier +','+ this._tag_table_identifier);
  1842. + tags.removeClass('selected');
  1843. + if (!resultsDom.is(':visible')) {
  1844. + resultsDom.show();
  1845. + }
  1846. + tags.filter(':visible').first().addClass('selected');
  1847. + },
  1848. +
  1849. + _hideTagsPicker: function (e) {
  1850. + var container = this._tags_results;
  1851. + if (container.has(e.target).length === 0) {
  1852. + container.hide();
  1853. + }
  1854. + },
  1855. +
  1856. + onCloseTag: function (el) {
  1857. + var tag = $(el).parents(this._tag_item_identifier),
  1858. + siblings = tag.siblings(),
  1859. + total_siblings = siblings.length;
  1860. + if (total_siblings == 1) {
  1861. + tag.closest('.tags-group').remove()
  1862. + } else {
  1863. + tag.remove();
  1864. + }
  1865. + },
  1866. +
  1867. + groupNameFromId : function(id) {
  1868. + var group = this._findTagGroupById(id);
  1869. + if (group) {
  1870. + return group.name;
  1871. + }
  1872. + return '';
  1873. + },
  1874. +
  1875. + _findTagGroupById : function(id) {
  1876. + for (var i=0; i < this._tag_groups.length; i++) {
  1877. + var tag_group = this._tag_groups[i];
  1878. + if (tag_group.id == id) {
  1879. + return tag_group;
  1880. + }
  1881. + }
  1882. + return null;
  1883. + },
  1884. +
  1885. + groupColorFromId : function(id) {
  1886. + var group = this._findTagGroupById(id);
  1887. + if (group) {
  1888. + return group.color_hex;
  1889. + }
  1890. + return '#ffffff';
  1891. + },
  1892. +
  1893. + _onAddTagToSearch: function (el) {
  1894. + var tag_group_id = $(el).find(this._tag_group_id).html(),
  1895. + privacy = $(el).find(this._privacy).html(),
  1896. + tag_group_name = this.groupNameFromId(tag_group_id),
  1897. + tag_group_color = this.groupColorFromId(tag_group_id),
  1898. + tag_name = $(el).find(this._tag_name).html();
  1899. +
  1900. + debugger;
  1901. + if (this._tagAlreadyExists(tag_group_id, tag_name, this._container_div.find(this._tag_area))) {
  1902. + return;
  1903. + }
  1904. +
  1905. + var html = Nightloop.Templates.Widget.Tag({
  1906. + 'is_new_style': true,
  1907. + 'newly_added': true,
  1908. + 'tag_name': tag_name,
  1909. + 'tag_group_id': tag_group_id,
  1910. + 'tag_group_name': tag_group_name,
  1911. + 'tag_color': tag_group_color,
  1912. + 'is_private': privacy.toUpperCase() == 'PRIVATE',
  1913. + 'close_func': 'Pmp.Manager.Tags.Lookup.onCloseTag(this)'
  1914. + });
  1915. +
  1916. + // find category it belongs to and add after last one
  1917. + var added = false;
  1918. +
  1919. + this._container_div.find(this._tags_group +','+ this._tag_area_edit).each(_.bind(function (idx, el) {
  1920. + if ($(el).attr('tag_group_id') === tag_group_id) {
  1921. + // found the group
  1922. + var tag_containers = $(el).find(this._tag_item_identifier);
  1923. + if (tag_containers.length) {
  1924. + $(html).insertAfter(tag_containers.last());
  1925. + } else {
  1926. + $(html).insertBefore(this._container_div.find(this._insert_tag_area), $(el));
  1927. + }
  1928. +
  1929. + // Bind events
  1930. + $(html).find(this._tag_item).on('mouseover', function(ev) {
  1931. + $(this).addClass('hover')
  1932. + });
  1933. + $(html).find(this._tag_item).on('mouseout', function(ev) {
  1934. + $(this).removeClass('hover')
  1935. + });
  1936. +
  1937. + added = true;
  1938. + return false;
  1939. + }
  1940. + }, this));
  1941. +
  1942. + // category doesn't exist
  1943. + if (!added) {
  1944. + var last_tag_group = this._container_div.find(this._tags_group +','+ this._tag_area).last();
  1945. + if (last_tag_group.length) {
  1946. + var tag_group_html = Nightloop.Templates.Widget.TagsInGroup({
  1947. + 'tag_group': {
  1948. + 'name': tag_group_name,
  1949. + 'id': tag_group_id,
  1950. + 'is_private': privacy.toUpperCase() == 'PRIVATE',
  1951. + 'tags': [{
  1952. + 'tag_name': tag_name,
  1953. + 'is_new_style': true,
  1954. + 'newly_added': true,
  1955. + 'tag_group_id': tag_group_id,
  1956. + 'tag_group_name': tag_group_name,
  1957. + 'is_private': privacy.toUpperCase() == 'PRIVATE'
  1958. + }]
  1959. + },
  1960. + 'is_new_style': true,
  1961. + 'color_hex': tag_group_color,
  1962. + 'can_view_private': true, // doesn't matter
  1963. + 'close_func': 'Pmp.Manager.Tags.Lookup.onCloseTag(this)'
  1964. + });
  1965. + $(tag_group_html).insertAfter(last_tag_group);
  1966. + } else {
  1967. + var tag_group_container_html = Nightloop.Templates.Widget.TagsByGroupDisplay({
  1968. + 'tag_groups': [{
  1969. + 'name': tag_group_name,
  1970. + 'id': tag_group_id,
  1971. + 'is_private': privacy.toUpperCase() == 'PRIVATE',
  1972. + 'is_new_style': true,
  1973. + 'color_hex': tag_group_color,
  1974. + 'tags': [{
  1975. + 'tag_name': tag_name,
  1976. + 'tag_group_id': tag_group_id,
  1977. + 'is_new_style': true,
  1978. + 'newly_added': true,
  1979. + 'tag_group_name': tag_group_name,
  1980. + 'is_private': privacy.toUpperCase() == 'PRIVATE'
  1981. + }]
  1982. + }],
  1983. + 'is_new_style': true,
  1984. + 'can_view_private': true, // doesn't matter
  1985. + 'close_func': 'Pmp.Manager.Tags.Lookup.onCloseTag(this)'
  1986. + });
  1987. + this._container_div.find(this._tag_area).html(tag_group_container_html)
  1988. + }
  1989. + this.renderTags();
  1990. + }
  1991. +
  1992. + this._tags_input.val('');
  1993. + this._toggle_tags_display(true);
  1994. + },
  1995. +
  1996. + _toggle_tags_display: function(should_show) {
  1997. + var selectedElements = this._container_div.find(this._tag_table_group_identifier + ',' + this._tag_table_identifier + ',' +
  1998. + this._tag_item_identifier + ',' + this._tag_table_identifier);
  1999. + if (should_show) {
  2000. + $(selectedElements).show();
  2001. + } else {
  2002. + $(selectedElements).hide();
  2003. + }
  2004. + },
  2005. +
  2006. + _tagAlreadyExists: function (tag_group_id, new_tag_name, tag_group_obj) {
  2007. + var tag_map = {};
  2008. + $(tag_group_obj).find(this._tag_name).each(function (e, div) {
  2009. + var tag_name = $(div).html(),
  2010. + existing_tag_group_id = $(div).parents(this._tag_item_identifier).find(this._tag_group_id).html();
  2011. +
  2012. + tag_map[tag_name.toLowerCase() + existing_tag_group_id] = true;
  2013. + });
  2014. + return ((new_tag_name.toLowerCase() + tag_group_id) in tag_map);
  2015. + },
  2016. +
  2017. + _startsWith : function(search_str, full_str) {
  2018. + return(full_str.indexOf(search_str) == 0);
  2019. + },
  2020. +
  2021. + renderTags : function() {
  2022. + this._container_div.find(this._tags_group).filter('.new-style').each(_.bind(function (e, obj){
  2023. + var tag_group_id = $(obj).find(this._tag_group_id).val(),
  2024. + tag_group_obj = this._findTagGroupById(tag_group_id),
  2025. + bg_color_hex = tag_group_obj.color_hex;
  2026. + $(obj).find(this._tags_group_category_identifier).find('span').css({'background-color':bg_color_hex});
  2027. + }, this));
  2028. +
  2029. + this._container_div.find(this._tag_item).each(_.bind(function(e,obj){
  2030. + $(this).on('mouseover', function(event) {
  2031. + $(this).addClass('hover')
  2032. + });
  2033. + $(this).on('mouseout', function(event) {
  2034. + $(this).removeClass('hover')
  2035. + });
  2036. + var tag_group_id = $(obj).find(this._tag_group_id).val();
  2037. + if (tag_group_id == '') {
  2038. + tag_group_id = $(obj).find(this._tag_group_id).html();
  2039. + }
  2040. + var tag_group_obj = this._findTagGroupById(tag_group_id);
  2041. + // some tags can be removed from tag list but still be on other objects
  2042. + if (tag_group_obj) {
  2043. + var bg_color_hex = tag_group_obj.color_hex;
  2044. + $(obj).find(this._tag_item_color_identifier).css({'background-color':bg_color_hex});
  2045. + $(obj).parents(this._tag_item_identifier).attr('sort_order_group', tag_group_obj.sort_order);
  2046. + $(obj).parents(this._tags_group).attr('sort_order_group', tag_group_obj.sort_order);
  2047. + $(obj).parents(this._tags_group).attr('tag_group_id', tag_group_id);
  2048. + }
  2049. + }, this));
  2050. + },
  2051. +}
  2052. \ No newline at end of file
  2053. diff --git a/application/site/static/js/react/service_status.jsx b/application/site/static/js/react/service_status.jsx
  2054. index cd26f4a..43fea29 100644
  2055. --- a/application/site/static/js/react/service_status.jsx
  2056. +++ b/application/site/static/js/react/service_status.jsx
  2057. @@ -177,14 +177,14 @@ var Status = React.createClass({
  2058. switch_type += ' check';
  2059. }
  2060. return(
  2061. - <div className='list-row'>
  2062. - <div className='row-title'>
  2063. - <span>{this.state.display}</span>
  2064. - </div>
  2065. - <div className={switch_type} onClick={this.clickEnable}>
  2066. + <div className='list-row'>
  2067. + <div className='row-title'>
  2068. + <span>{this.state.display}</span>
  2069. + </div>
  2070. + <div className={switch_type} onClick={this.clickEnable}>
  2071. + </div>
  2072. + <div className='float-end'></div>
  2073. </div>
  2074. - <div className='float-end'></div>
  2075. - </div>
  2076. );
  2077. /*ignore jslint end*/
  2078. }
  2079. diff --git a/application/site/templates/manager/manager.clients.merge.soy b/application/site/templates/manager/manager.clients.merge.soy
  2080. index 06cb353..c15c07e 100644
  2081. --- a/application/site/templates/manager/manager.clients.merge.soy
  2082. +++ b/application/site/templates/manager/manager.clients.merge.soy
  2083. @@ -66,7 +66,7 @@
  2084. Company
  2085. </div>
  2086. <div class="col col-clientgroup">
  2087. - Client Groups
  2088. + Client codes
  2089. </div>
  2090.  
  2091. {if $content.member_profiles_exist}
  2092. diff --git a/application/site/templates/manager/manager.clients.profile.soy b/application/site/templates/manager/manager.clients.profile.soy
  2093. index 54c6e5f..b82ecd3 100644
  2094. --- a/application/site/templates/manager/manager.clients.profile.soy
  2095. +++ b/application/site/templates/manager/manager.clients.profile.soy
  2096. @@ -355,7 +355,7 @@
  2097. <div class="form-element text groups">
  2098. <label for="">
  2099. <p class="label">
  2100. - Client groups
  2101. + Client codes
  2102. </p>
  2103. <div id="groups-area" class="input">
  2104.  
  2105. @@ -815,8 +815,9 @@
  2106. {if $content.venue_group_client}
  2107. {call Nightloop.Templates.Widget.TagsByGroupDisplay}
  2108. {param tag_groups:$content.venue_group_client.tags_group_display /}
  2109. + {param is_new_style:true /}
  2110. {param can_view_private:$content.can_view_private_notes /}
  2111. - {param close_func: 'Pmp.Manager.Clients.Profile.onCloseTag(this)' /}
  2112. + {param close_func: 'Pmp.Manager.Tags.Lookup.onCloseTag(this)' /}
  2113. {/call}
  2114. {/if}
  2115. {else}
  2116. @@ -905,6 +906,26 @@
  2117. <span>no shows</span>
  2118. </p>
  2119. </div>
  2120. + <div class="stat-group service">
  2121. + <strong>
  2122. + Service cheat sheet
  2123. + </strong>
  2124. + </div>
  2125. + {if $content.venue_group_client.default_tags}
  2126. + <table class="stat-group">
  2127. + {foreach $default_tag in $content.venue_group_client.default_tags}
  2128. + <tr>
  2129. + <td class="tags-icon" align="center">
  2130. + <img src="{$MEDIA_URL}images/tags/{$default_tag.type}.png" alt="{$default_tag.type}" />
  2131. + <span>{$default_tag.name}</span>
  2132. + </td>
  2133. + <td class="tags-list">
  2134. + <span>{$default_tag.tags_list}</span>
  2135. + </td>
  2136. + </tr>
  2137. + {/foreach}
  2138. + </table>
  2139. + {/if}
  2140. </div>
  2141. </div>
  2142. {/if}
  2143. @@ -1008,8 +1029,20 @@
  2144. );
  2145.  
  2146. Pmp.Common.TagCache.initialize("{$content.tag_url}");
  2147. - Pmp.Common.TagCache.refresh(function() {lb}
  2148. + Pmp.Common.TagCache.refresh(function(content) {lb}
  2149. Pmp.Common.TagCache.renderTagTable('#find-tags-results');
  2150. + Pmp.Manager.Tags.Lookup.initialize(
  2151. + content.tag_groups,
  2152. + $('#profile-summary-edit-pane .tag-editor'),
  2153. + '#find-tags-input',
  2154. + '#find-tags-results',
  2155. + '.find-tags-container',
  2156. + '.tag-item-container',
  2157. + '.tag-table-container',
  2158. + '.tag-group-container'
  2159. + );
  2160. +
  2161. + Pmp.Manager.Tags.Lookup.bindEvents();
  2162. Pmp.Common.TagCache.sortTagsGroup('.tag-area-css');
  2163. Pmp.Manager.Clients.Profile._adjustBoxHeight();
  2164. {rb});
  2165. diff --git a/application/site/templates/manager/manager.clients.soy b/application/site/templates/manager/manager.clients.soy
  2166. index 9113075..2cb37dc 100644
  2167. --- a/application/site/templates/manager/manager.clients.soy
  2168. +++ b/application/site/templates/manager/manager.clients.soy
  2169. @@ -28,9 +28,9 @@
  2170.  
  2171. <div id="sidebar">
  2172. <div class="clientgroups-container">
  2173. - <h3 class="subheader">Client Groups</h3>
  2174. + <h3 class="subheader">Client codes</h3>
  2175. <ul class="submenu clientgroups"></ul>
  2176. - <a class='menu-link' href="{$venue.manager_base_url}/manage/clientgroups">Add client groups</a>
  2177. + <a class='menu-link' href="{$venue.manager_base_url}/manage/clientgroups">Add client codes</a>
  2178. </div>
  2179.  
  2180. <div class="membershipgroups-container no-display">
  2181. diff --git a/application/site/templates/manager/manager.maininterface.soy b/application/site/templates/manager/manager.maininterface.soy
  2182. index b4c62c7..f819d25 100644
  2183. --- a/application/site/templates/manager/manager.maininterface.soy
  2184. +++ b/application/site/templates/manager/manager.maininterface.soy
  2185. @@ -194,7 +194,7 @@
  2186. <span class="auto -est_arrival_time_display"></span>
  2187. </p>
  2188. {/if}
  2189. - /* A blank option is returned if no reservation types have been added. */
  2190. + /* A blank option is returned if no reservation codes have been added. */
  2191. {if $content.reservation_types and length($content.reservation_types) > 1}
  2192. <p class="info">
  2193. <em>Type</em>
  2194. diff --git a/application/site/templates/manager/manager.manage.clientgroup.edit.soy b/application/site/templates/manager/manager.manage.clientgroup.edit.soy
  2195. index 3f24dd2..6224089 100644
  2196. --- a/application/site/templates/manager/manager.manage.clientgroup.edit.soy
  2197. +++ b/application/site/templates/manager/manager.manage.clientgroup.edit.soy
  2198. @@ -1,7 +1,7 @@
  2199. {namespace Nightloop.Templates.Manager.Manage}
  2200.  
  2201. /**
  2202. - * Client Groups edit/create page
  2203. + * Client Codes edit/create page
  2204. */
  2205. {template .ClientGroupEdit}
  2206. {call Nightloop.Templates.Manager.Layout data="all" }
  2207. @@ -24,7 +24,7 @@
  2208. <div id="main-area">
  2209. <div id="content-header">
  2210. <h2>
  2211. - <a href="{$venue.manager_base_url}/manage/clientgroups">CLIENT GROUPS</a>
  2212. + <a href="{$venue.manager_base_url}/manage/clientgroups">CLIENT CODES</a>
  2213. /
  2214. {if $content.group_id}
  2215. {$content.group.name}
  2216. diff --git a/application/site/templates/manager/manager.manage.clientgroups.soy b/application/site/templates/manager/manager.manage.clientgroups.soy
  2217. index 7a6ffd6..2d0d22e 100644
  2218. --- a/application/site/templates/manager/manager.manage.clientgroups.soy
  2219. +++ b/application/site/templates/manager/manager.manage.clientgroups.soy
  2220. @@ -1,7 +1,7 @@
  2221. {namespace Nightloop.Templates.Manager.Manage}
  2222.  
  2223. /**
  2224. - * Client Groups page
  2225. + * Client Codes page
  2226. */
  2227. {template .ClientGroups}
  2228. {call Nightloop.Templates.Manager.Layout data="all" }
  2229. @@ -11,7 +11,7 @@
  2230.  
  2231.  
  2232. /**
  2233. - * Client groups template
  2234. + * Client codes template
  2235. * @param content
  2236. * @param venue
  2237. * @param venue_settings
  2238. @@ -23,7 +23,7 @@
  2239. <div id="page-client-groups" class="has-sidebar">
  2240. <div id="main-area">
  2241. <div id="content-header">
  2242. - <h2>CLIENT GROUPS</h2>
  2243. + <h2>CLIENT CODES</h2>
  2244. <p class="button">
  2245. <a id="add-client-group" href="{$venue.manager_base_url}/manage/clientgroups/create">Add Client Group</a>
  2246. </p>
  2247. diff --git a/application/site/templates/manager/manager.manage.reservationtypes.edit.soy b/application/site/templates/manager/manager.manage.reservationtypes.edit.soy
  2248. index d1a0a62..1185280 100644
  2249. --- a/application/site/templates/manager/manager.manage.reservationtypes.edit.soy
  2250. +++ b/application/site/templates/manager/manager.manage.reservationtypes.edit.soy
  2251. @@ -1,7 +1,7 @@
  2252. {namespace Nightloop.Templates.Manager.Manage.ReservationTypes}
  2253.  
  2254. /**
  2255. - * Reservation Types page
  2256. + * Reservation Codes page
  2257. */
  2258. {template .Edit}
  2259. {call Nightloop.Templates.Manager.Layout data="all" }
  2260. @@ -11,7 +11,7 @@
  2261.  
  2262.  
  2263. /**
  2264. - * Reservation Types template
  2265. + * Reservation Codes template
  2266. * @param venue
  2267. * @param venue_settings
  2268. * @param content
  2269. @@ -23,7 +23,7 @@
  2270. <div id="page-reservation-types" class="has-sidebar">
  2271. <div id="main-area">
  2272. <div id="content-header">
  2273. - <h2>RESERVATION TYPES</h2>
  2274. + <h2>RESERVATION CODES</h2>
  2275. </div>
  2276. {if $content.message}
  2277. <div class="global-message success fade">{$content.message}</div>
  2278. @@ -41,7 +41,7 @@
  2279. {/foreach}
  2280. </div>
  2281. <p class="indent">
  2282. - <a id="add-new-reservation-type" href="javascript:void(0)">Add new reservation type</a>
  2283. + <a id="add-new-reservation-type" href="javascript:void(0)">Add new reservation code</a>
  2284. </p>
  2285. <p class="button">
  2286. <a id="reservation-types-submit-btn" href="">Save changes</a>
  2287. diff --git a/application/site/templates/manager/manager.manage.tags.soy b/application/site/templates/manager/manager.manage.tags.soy
  2288. index 48e34a4..6a84a6d 100644
  2289. --- a/application/site/templates/manager/manager.manage.tags.soy
  2290. +++ b/application/site/templates/manager/manager.manage.tags.soy
  2291. @@ -13,43 +13,56 @@
  2292. * Manage Tags
  2293. * @param content
  2294. * @param venue
  2295. + * @param label
  2296. + * @param identifier
  2297. * @param venue_settings
  2298. * @param MEDIA_URL
  2299. */
  2300. {template .TagsBit}
  2301. {call Nightloop.Templates.Manager.SettingsSidebar data="all"}
  2302. - {param subcategory: 'tags' /}
  2303. + {param subcategory: $identifier /}
  2304. {/call}
  2305. <div id="page-tags" class="has-sidebar">
  2306. <div id="main-area">
  2307. <div id="content-header">
  2308. +<<<<<<< Updated upstream
  2309. <h2>Manage Tags - {$content.venue_group_name}</h3>
  2310. +<<<<<<< Updated upstream
  2311. + <p class="button">
  2312. + <a id="new-tag-category-link" href="javascript:void(0);">New tag category</a>
  2313. + </p>
  2314. +=======
  2315. +=======
  2316. + <h2>Manage {$label} - {$content.venue_group_name}</h3>
  2317. + <p class="button">
  2318. + <a id="new-tag-category-link" href="javascript:void(0);">New {$label} category</a>
  2319. + </p>
  2320. +>>>>>>> Stashed changes
  2321. +>>>>>>> Stashed changes
  2322. </div>
  2323. {if $content.error_message}
  2324. <p class="global-message error fade">{$content.error_message}</p>
  2325. {/if}
  2326. - <div id="content-area" class="control-block">
  2327. + <div id="content-area" class="control-block {if $content and not $content.display}no-display{/if}">
  2328. {foreach $tag_group in $content.tag_groups}
  2329. {call .TagGroup}
  2330. {param MEDIA_URL:$MEDIA_URL /}
  2331. {param can_manage_private:$content.can_manage_private /}
  2332. {param tag_group:$tag_group /}
  2333. + {param tag_group_types:$content.tag_group_types /}
  2334. {/call}
  2335. {/foreach}
  2336. <div id="insert-tag-groups-here"></div>
  2337. <div id="tag-instructions"></div>
  2338. {if length($content.tag_groups) == 0}
  2339. - <div id="sample-tag">There are no tags yet. <a target="_blank" href="{$MEDIA_URL}images/sample-tag-list.png">See a sample list</a>.</div>
  2340. + <div id="sample-tag">There are no {$label} yet. <a target="_blank" href="{$MEDIA_URL}images/sample-tag-list.png">See a sample list</a>.</div>
  2341. {/if}
  2342. </div>
  2343. - <div id="content-new-category-area" class="control-block">
  2344. - <a id="new-tag-category-link" href="javascript:void(0);"><span class="adder-link">+</span>New tag category</a>
  2345. - </div>
  2346. <div id="action-tags" class="control-block">
  2347. <form method="POST" action="{$venue.manager_base_url}/manage/tags/bulk">
  2348. <h3>Bulk Operations</h3>
  2349. <div class="actions">
  2350. - <span class="line">Apply tag </span>
  2351. + <span class="line">Apply {$label} </span>
  2352. <span class="line">
  2353. {call Nightloop.Templates.Widget.TagPicker}
  2354. {param results_id: 'apply-tag-results' /}
  2355. @@ -57,7 +70,7 @@
  2356. {param scope_id: 'apply-tag-container' /}
  2357. {/call}
  2358. </span>
  2359. - <span class="line"> to client profiles with tag </span>
  2360. + <span class="line"> to client profiles with {$label}</span>
  2361. <span class="line">
  2362. {call Nightloop.Templates.Widget.TagPicker}
  2363. {param results_id: 'apply-tag-target-results' /}
  2364. @@ -77,8 +90,8 @@
  2365. <img src="{$MEDIA_URL}images/important.png" />
  2366. </p>
  2367. <p class="description">
  2368. - Tags you have removed from this list may still appear on client profiles. Click SYNC to
  2369. - clear removed tags from your database (this action is irreversible and may take up to 60 minutes in the background).
  2370. + {$label} you have removed from this list may still appear on client profiles. Click SYNC to
  2371. + clear removed {$label} from your database (this action is irreversible and may take up to 60 minutes in the background).
  2372. </p>
  2373. <div class="float-end"></div>
  2374. </div>
  2375. @@ -92,7 +105,7 @@
  2376. <script type="text/javascript">
  2377. $(document).ready( function() {lb}
  2378. var can_manage_private = {if $content.can_manage_private}true{else}false{/if};
  2379. - Pmp.Manager.Manage.Tags.initialize("{$venue.manager_base_url}","{$MEDIA_URL}", can_manage_private);
  2380. + Pmp.Manager.Manage.Tags.initialize("{$venue.manager_base_url}","{$MEDIA_URL}", can_manage_private, "{$identifier}");
  2381. Pmp.Common.TagCache.initialize("{$content.tags_url}");
  2382. Pmp.Common.TagCache.refresh(function() {lb}
  2383. Pmp.Common.TagCache.renderTagTable("#apply-tag-results");
  2384. @@ -100,6 +113,7 @@
  2385. {rb}, true);
  2386. Pmp.Common.TagCache.initializeTagPicker("#apply-tag-input", "#apply-tag-results", "#apply-tag-container", "from");
  2387. Pmp.Common.TagCache.initializeTagPicker("#apply-tag-target-input", "#apply-tag-target-results", "#apply-tag-target-container", "to");
  2388. + $('#content-area').toggleClass('no-display');
  2389. {rb})
  2390. </script>
  2391. </div>
  2392. @@ -116,13 +130,22 @@
  2393. <div class="tag-group-block" name="{if $tag_group}{if $tag_group.name}{$tag_group.name}-webdriver{/if}{/if}">
  2394.  
  2395. <div class="category-header view-mode-only">
  2396. - <div class="category-name-header">{if $tag_group}{if $tag_group.name}{$tag_group.name}{if $tag_group.privacy == 'PRIVATE'}{sp}(private) {/if}{/if}{/if}</div>
  2397. + <div class="category-name-header">
  2398. + {if $tag_group}
  2399. + {if $tag_group.name}{$tag_group.name}
  2400. + {if $tag_group.is_global} (Global){/if}
  2401. + {if $tag_group.privacy == 'PRIVATE'}{sp}(private) {/if}{/if}
  2402. + {/if}
  2403. + </div>
  2404. + {if $tag_group and $tag_group.is_default > 0}
  2405. + <div class="enable-header {if $tag_group.disabled == 0} on {/if}"></div>
  2406. + {/if}
  2407. /* <div class="move-pic no-display"><img src="{$MEDIA_URL}images/up-down-arrows.png" /></div> */
  2408. <div class="float-end"></div>
  2409. </div>
  2410.  
  2411. <input type="hidden" class="tag-group-id" value="{if $tag_group}{if $tag_group.id}{$tag_group.id}{/if}{/if}" />
  2412. -
  2413. +
  2414. <div class="tag-group-metadata edit-mode-only">
  2415. <div class="input-col float-left">
  2416. <div class="input-area">
  2417. @@ -150,7 +173,7 @@
  2418. </div>
  2419. </div>
  2420. </div>
  2421. - <div class="input-col float-left {if not $can_manage_private}no-display{/if}">
  2422. + <div class="input-col float-left {if $tag_group and $tag_group.is_default}no-display{/if}">
  2423. <div class="form-element select privacy">
  2424. <label>
  2425. <p class="label">
  2426. @@ -168,11 +191,26 @@
  2427. </label>
  2428. </div>
  2429. </div>
  2430. -
  2431. + <div class="input-col float-left {if $tag_group and ($tag_group.is_default or $tag_group.is_global)}no-display{/if}">
  2432. + <div class="form-element select level">
  2433. + <label>
  2434. + <p class="label">
  2435. + Scope
  2436. + </p>
  2437. + <p class="input">
  2438. + <select class="tag-group-scope">
  2439. + <option value="1" {if $tag_group}{if $tag_group.is_global}selected="selected"{/if}{/if}>Global</option>
  2440. + <option value="0" {if $tag_group}{if not $tag_group.is_global}selected="selected"{/if}{/if}>Local</option>
  2441. + </select>
  2442. + <span class="downer"></span>
  2443. + </p>
  2444. + </label>
  2445. + </div>
  2446. + </div>
  2447. <div class="float-end"></div>
  2448. </div>
  2449. -
  2450. - <div class="tag-group-tags">
  2451. +
  2452. + <div class="tag-group-tags {if $tag_group and $tag_group.disabled}no-display{/if}">
  2453. <div class="edit-mode-only">
  2454. <div class="tag-group-add">
  2455. <input class="add-tag-input" type="text" />
  2456. @@ -208,9 +246,11 @@
  2457. <p class="cancel-link-area button plain">
  2458. <a class="cancel-link" href="javascript:void(0);">cancel</a>
  2459. </p>
  2460. - <p class="button danger">
  2461. - <a class="delete-category-link" href="javascript:void(0);">Delete category</a>
  2462. - </p>
  2463. + {if $tag_group and $tag_group.type == 0}
  2464. + <p class="button danger">
  2465. + <a class="delete-category-link" href="javascript:void(0);">Delete category</a>
  2466. + </p>
  2467. + {/if}
  2468. <div class="delete-category-area">
  2469. <div class="delete-category-container no-display">
  2470. <div class="delete-category local-popup">
  2471. diff --git a/application/site/templates/manager/manager.requestactionform.soy b/application/site/templates/manager/manager.requestactionform.soy
  2472. index 5542aa9..54c4078 100644
  2473. --- a/application/site/templates/manager/manager.requestactionform.soy
  2474. +++ b/application/site/templates/manager/manager.requestactionform.soy
  2475. @@ -84,7 +84,7 @@
  2476. {if $venue.is_nightlife_class}
  2477. <div class="form-element select inline">
  2478. <label for="res_type">
  2479. - <p class="label pre">Reservation Type</p>
  2480. + <p class="label pre">Reservation Code</p>
  2481. <p id="res-type-wrap" class="input">
  2482. <select id="res_type" name="res_type">
  2483. <option value="TABLE">Table Service</option>
  2484. diff --git a/application/site/templates/manager/manager.reservationform.soy b/application/site/templates/manager/manager.reservationform.soy
  2485. index 2a30081..64ce2be 100644
  2486. --- a/application/site/templates/manager/manager.reservationform.soy
  2487. +++ b/application/site/templates/manager/manager.reservationform.soy
  2488. @@ -251,7 +251,12 @@
  2489. {if $content.reservation_types and length($content.reservation_types) > 1 and not $content.reservations_require_approval}
  2490. <div class="form-element select reservation-type nightlife">
  2491. <label for="reservation-type">
  2492. +<<<<<<< Updated upstream
  2493. + <p class="label">Reservation code</p>
  2494. +=======
  2495. +<<<<<<< Updated upstream
  2496. <p class="label">Reservation type</p>
  2497. +>>>>>>> Stashed changes
  2498. <p class="input">
  2499. <select name="reservation_type" class="auto" id="reservation-type-select">
  2500. {foreach $restype in $content.reservation_types}
  2501. @@ -260,8 +265,61 @@
  2502. </select>
  2503. <span class="downer"></span>
  2504. </p>
  2505. +=======
  2506. + <p class="label">Reservation code</p>
  2507. + <div id="tag-manager" class="tag-editor">
  2508. + <div class="add-tags-area">
  2509. + <div class="find-tags-container">
  2510. + <input id="find-tags-input">
  2511. + <div class="relative-container">
  2512. + <div class="no-display" id="find-tags-results">
  2513. + <div id="find-tags-results">
  2514. + <div class="tag-table-container new-style selected" >
  2515. + {call Nightloop.Templates.Widget.TagTable}
  2516. + {param tag_groups:$content.reservation_types /}
  2517. + {/call}
  2518. + </div>
  2519. + </div>
  2520. + </div>
  2521. + </div>
  2522. + </div>
  2523. + </div>
  2524. + <div class="tag-area tag-area-css tag-area-edit">
  2525. + <div class="tag-group-display-container">
  2526. + </div>
  2527. + </div>
  2528. + </div>
  2529. +>>>>>>> Stashed changes
  2530. </label>
  2531. </div>
  2532. + <script type="text/javascript">
  2533. + $(document).ready( function() {lb}
  2534. + console.log("{$content.reservation_tags_url}");
  2535. + Pmp.Common.TagCache.initialize("{$content.reservation_tags_url}");
  2536. + Pmp.Common.TagCache.refresh(function(content) {lb}
  2537. + //Pmp.Common.TagCache.renderTagTable('#find-tags-results');
  2538. + //Pmp.Common.TagCache.sortTags('.tags-area-sortable');
  2539. + //Pmp.Common.TagCache.initializeTagPicker("#add-tag-input",
  2540. + //"#add-tag-results",
  2541. + //"#add-tag-container",
  2542. + //"add",
  2543. + //"add-client-tags-here",
  2544. + //"add-client-tags-container");
  2545. + Pmp.Manager.Tags.Lookup.initialize(
  2546. + content.tag_groups,
  2547. + $('.reservation-type .tag-editor'),
  2548. + '#find-tags-input',
  2549. + '#find-tags-results',
  2550. + '.find-tags-container',
  2551. + '.tag-item-container',
  2552. + '.tag-table-container',
  2553. + '.tag-group-container'
  2554. + );
  2555. +
  2556. + Pmp.Manager.Tags.Lookup.bindEvents();
  2557. + {rb});
  2558. + {rb});
  2559. + </script>
  2560. <div id="reservation-type-color-indicator" class="form-element text inline-end">
  2561. <label for="reservation-type-color">
  2562. <p class="label">&nbsp;</p>
  2563. @@ -444,13 +502,13 @@
  2564. {call .CostOptionsForm data="all"/}
  2565. {/if}
  2566.  
  2567. - /* A blank option is returned if no reservation types have been added. */
  2568. + /* A blank option is returned if no reservation codes have been added. */
  2569. {if $venue.is_nightlife_class}
  2570. {if $content.reservation_types and length($content.reservation_types) > 1 and not $content.reservations_require_approval}
  2571. <div class="inline">
  2572. <div class="form-element select">
  2573. <label for="reservation-type">
  2574. - <p class="label">Reservation type</p>
  2575. + <p class="label">Reservation code</p>
  2576. <p class="input">
  2577. <select name="reservation_type" class="auto" id="reservation-type-select">
  2578. {foreach $restype in $content.reservation_types}
  2579. @@ -625,7 +683,7 @@
  2580. <div class="form-element text groups">
  2581. <label for="">
  2582. <p class="label">
  2583. - Client groups
  2584. + Client codes
  2585. </p>
  2586. <div id="groups-area" class="input">
  2587.  
  2588. diff --git a/application/site/templates/manager/manager.reservations.soy b/application/site/templates/manager/manager.reservations.soy
  2589. index 3c8d2fb..fe75a61 100644
  2590. --- a/application/site/templates/manager/manager.reservations.soy
  2591. +++ b/application/site/templates/manager/manager.reservations.soy
  2592. @@ -846,7 +846,7 @@
  2593. {/if}
  2594.  
  2595. {if $content.reservation_types and length($content.reservation_types) > 1}
  2596. - <li><a id="regroup-link-restype" href="javascript:void(0)">Reservation type</a></li>
  2597. + <li><a id="regroup-link-restype" href="javascript:void(0)">Reservation code</a></li>
  2598. {/if}
  2599. </ul>
  2600.  
  2601. diff --git a/application/site/templates/manager/manager.settingssidebar.soy b/application/site/templates/manager/manager.settingssidebar.soy
  2602. index 3781c9d..e74d1c3 100644
  2603. --- a/application/site/templates/manager/manager.settingssidebar.soy
  2604. +++ b/application/site/templates/manager/manager.settingssidebar.soy
  2605. @@ -21,9 +21,9 @@
  2606. {if $user_domain.venue_manage_tag_list}
  2607. <li><a class="{if $subcategory == 'tags'}selected{/if}" id="" href="{$venue.manager_base_url}/manage/tags">Tags</a></li>
  2608. {/if}
  2609. - <li><a class="{if $subcategory == 'reservation_types'}selected{/if}" id="" href="{$venue.manager_base_url}/manage/reservationtypes">Reservation types</a></li>
  2610. + <li><a class="{if $subcategory == 'reservation_types'}selected{/if}" id="" href="{$venue.manager_base_url}/manage/reservationtypes">Reservation codes</a></li>
  2611. {if $user_domain.can_manage_client_groups}
  2612. - <li><a class="{if $subcategory == 'clientgroups'}selected{/if}" href="{$venue.manager_base_url}/manage/clientgroups">Client groups</a></li>
  2613. + <li><a class="{if $subcategory == 'clientgroups'}selected{/if}" href="{$venue.manager_base_url}/manage/clientgroups">Client codes</a></li>
  2614. {/if}
  2615. {if $venue_settings and $venue_settings.membership_enabled and $user_domain.can_manage_membership_groups}
  2616. <li><a class="{if $subcategory == 'membershipgroups'}selected{/if}" href="{$venue.manager_base_url}/manage/membershipgroups">Membership groups</a></li>
  2617. diff --git a/application/site/templates/widget/widget.tag.soy b/application/site/templates/widget/widget.tag.soy
  2618. index 1d79218..4ec5076 100644
  2619. --- a/application/site/templates/widget/widget.tag.soy
  2620. +++ b/application/site/templates/widget/widget.tag.soy
  2621. @@ -12,11 +12,15 @@
  2622. * @param? full_hash_only
  2623. * @param? full_hash_prefix
  2624. * @param? confirm_close
  2625. + * @param? is_new_style
  2626. + * @param? newly_added
  2627. */
  2628. {template .Tag}
  2629. - <div class="tag-item-container float-left" sort_tag_name="{$tag_name}" sort_order_group="">
  2630. + <div class="tag-item-container float-left {if $is_new_style}new-style{/if} {if $newly_added}new{/if}" sort_tag_name="{$tag_name}" sort_order_group="">
  2631. <div class="tag-item" >
  2632. - <div class="tag-item-color float-left" style="background-color:{$tag_color};">&nbsp;</div>
  2633. + {if not $is_new_style}
  2634. + <div class="tag-item-color float-left" style="background-color:{$tag_color};">&nbsp;</div>
  2635. + {/if}
  2636. <div class="tag-name float-left">
  2637. {$tag_name}
  2638. </div>
  2639. @@ -97,7 +101,7 @@
  2640. * @param tag_groups
  2641. */
  2642. {template .TagTable}
  2643. - <div class="tag-table-container">
  2644. + <div class="tag-table-container new-style">
  2645. {foreach $tag_group in $tag_groups}
  2646. {call .TagTableGroup}
  2647. {param tag_group:$tag_group /}
  2648. @@ -112,7 +116,10 @@
  2649. */
  2650. {template .TagTableGroup}
  2651. <div class="tag-table-group">
  2652. - <div class="tag-table-category">{$tag_group.name}{if $tag_group.privacy == 'PRIVATE'}{sp}(private){/if}</div>
  2653. + <div class="tag-table-category">
  2654. + <span class="color float-left" style="background-color:{$tag_group.color_hex}"></span>
  2655. + <div>{$tag_group.name}{if $tag_group.privacy == 'PRIVATE'}{sp}(private){/if}</div>
  2656. + </div>
  2657. <div class="tag-table-tags">
  2658. {foreach $tag in $tag_group.tags}
  2659. {call .Tag}
  2660. @@ -135,23 +142,19 @@
  2661. * Tag Category Display
  2662. * @param tag_groups
  2663. * @param can_view_private
  2664. + * @param? is_new_style
  2665. * @param? close_func
  2666. */
  2667. {template .TagsByGroupDisplay}
  2668. <div class="tag-group-display-container">
  2669. {foreach $tag_group in $tag_groups}
  2670. - {if $close_func}
  2671. - {call .TagsInGroup}
  2672. - {param tag_group:$tag_group /}
  2673. - {param can_view_private:$can_view_private /}
  2674. - {param close_func: $close_func /}
  2675. - {/call}
  2676. - {else}
  2677. - {call .TagsInGroup}
  2678. - {param tag_group:$tag_group /}
  2679. - {param can_view_private:$can_view_private /}
  2680. - {/call}
  2681. - {/if}
  2682. + {call .TagsInGroup}
  2683. + {param tag_group:$tag_group /}
  2684. + {param can_view_private:$can_view_private /}
  2685. + {param is_new_style:$is_new_style /}
  2686. + {param background_color:$tag_group.color_hex /}
  2687. + {param close_func:$close_func /}
  2688. + {/call}
  2689. {/foreach}
  2690. </div>
  2691. {/template}
  2692. @@ -199,11 +202,20 @@
  2693. * Tag Box
  2694. * @param tag_group
  2695. * @param can_view_private
  2696. + * @param? is_new_style
  2697. + * @param? background_color
  2698. * @param? close_func
  2699. */
  2700. {template .TagsInGroup}
  2701. - <div class="tags-group">
  2702. - <div class="tags-group-category">{$tag_group.name}{if $tag_group.is_private}{sp}(private){/if}</div>
  2703. + <div class="tags-group {if $is_new_style}new-style{/if}">
  2704. + <div class="tags-group-category">
  2705. + {if $is_new_style}
  2706. + <span class="float-left" style="background-color: {$background_color}"></span>
  2707. + <div class="tag-group-name">{$tag_group.name}{if $tag_group.is_private}{sp}(private){/if}</div>
  2708. + {else}
  2709. + {$tag_group.name}{if $tag_group.is_private}{sp}(private){/if}
  2710. + {/if}
  2711. + </div>
  2712. <div class="tags-group-tags">
  2713. {foreach $tag in $tag_group.tags}
  2714. {if $tag.is_private}
  2715. @@ -215,6 +227,8 @@
  2716. {param tag_group_name: $tag.tag_group_name /}
  2717. {param tag_color: 'white' /}
  2718. {param text_color: 'gray' /}
  2719. + {param is_new_style:$is_new_style /}
  2720. + {param newly_added:$tag.newly_added /}
  2721. {param is_private: true /}
  2722. {param close_func: $close_func /}
  2723. {/call}
  2724. @@ -223,7 +237,9 @@
  2725. {param tag_name: $tag.tag_name /}
  2726. {param tag_group_id: $tag.tag_group_id /}
  2727. {param tag_group_name: $tag.tag_group_name /}
  2728. + {param is_new_style:$is_new_style /}
  2729. {param tag_color: 'white' /}
  2730. + {param newly_added:$tag.newly_added /}
  2731. {param text_color: 'gray' /}
  2732. {param is_private: true /}
  2733. {/call}
  2734. @@ -236,6 +252,8 @@
  2735. {param tag_group_id: $tag.tag_group_id /}
  2736. {param tag_group_name: $tag.tag_group_name /}
  2737. {param tag_color: 'white' /}
  2738. + {param newly_added:$tag.newly_added /}
  2739. + {param is_new_style:$is_new_style /}
  2740. {param text_color: 'gray' /}
  2741. {param close_func: $close_func /}
  2742. {/call}
  2743. @@ -243,7 +261,9 @@
  2744. {call .Tag}
  2745. {param tag_name: $tag.tag_name /}
  2746. {param tag_group_id: $tag.tag_group_id /}
  2747. + {param newly_added:$tag.newly_added /}
  2748. {param tag_group_name: $tag.tag_group_name /}
  2749. + {param is_new_style:$is_new_style /}
  2750. {param tag_color: 'white' /}
  2751. {param text_color: 'gray' /}
  2752. {/call}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement