Exemplo n.º 1
0
def add_discount(request,product,names,rates,eff_dates,exp_dates):
	dajax = Dajax()
	print "inside add discount"

	print product,names,rates,eff_dates,exp_dates

	product = get_object_or_404(Product, id=int(product))

	print product

	if len(names) == len(rates) == len(eff_dates) == len(exp_dates):

		for x in range(0, len(names)):
			print x,names[x]
			discount =  Discount()
			discount.product = product
			discount.name = names[x]
			discount.discount = rates[x]
			discount.effe_date = datetime.datetime.strptime(eff_dates[x], '%d/%m/%Y')
			discount.expi_date = datetime.datetime.strptime(exp_dates[x], '%d/%m/%Y')
			discount.save()

			dajax.script('DiscountShow();')
	else:
		print "Not a valid form"
		dajax.script('DiscountError();')

	return dajax.json()
Exemplo n.º 2
0
def delete_message(request, iid, type):
    dajax = Dajax()
    response_data = {}
    if iid:
        if type == "inbox_list":
            update_emails(request, iid)
            response_data['type'] = "inbox_list"
            response_data['id'] = json.dumps(iid)
            return json.dumps(response_data)

        elif type == "sent_list":
            update_sent_emails(request, iid)
            response_data['type'] = "inbox_list"
            response_data['id'] = json.dumps(iid)
            return json.dumps(response_data)

        elif type == "inbox_detail":
            update_emails(request, iid)
            response_data['type'] = "inbox_detail"
            return json.dumps(response_data)
        elif type == "sent_detail":
            response_data['type'] = "sent_detail"
            email = Emails.objects.get(pk=int(iid))
            if not email.from_delete:
                email.from_delete = True
                email.save()
            return json.dumps(response_data)
    return dajax.json()
Exemplo n.º 3
0
def signup(request, email=None, pwd=None, cpwd=None):

    dajax = Dajax()
    print "inside signup"
    if email and pwd:

        if pwd == cpwd:
            if User.objects.filter(email=email) or User.objects.filter(username=email):
                return simplejson.dumps(
                    {
                        "status": "warning",
                        "message": "A User already exist with this email address.Please select a different email address or login",
                    }
                )
            else:
                print "################################"
                staff = Staff()
                staff.username = email
                staff.email = email
                staff.set_password(pwd)
                staff.save()
                user = authenticate(username=staff.username, password=pwd)
                if user:
                    login(request, user)
                    return simplejson.dumps({"status": "reload", "message": "move to dashboard."})
        else:
            return simplejson.dumps({"status": "warning", "message": "Password Mismacthing"})
    else:
        print "Enter Valid Form"
        return simplejson.dumps({"status": "warning", "message": "Enter Valid Form."})
    return dajax.json()
Exemplo n.º 4
0
def savephone(request, phone_no=None, cid=None):
    dajax = Dajax()
    dajax.assign("#message", "innerHTML", "")
    if request.user.is_authenticated:
        if phone_no:
            customer = Customer.objects.get(id=cid)

            print customer
            phone = PhoneNumber()
            phone.customer = customer
            phone.phone_no = phone_no
            phone.save()
            dajax.assign(
                "#message",
                "innerHTML",
                """ <div class="alert alert-success"> Successfully added phone number to customer {0} <div>""".format(
                    customer.name
                ),
            )
            dajax.script("LocationReload();")
        else:
            dajax.assign(
                "#message",
                "innerHTML",
                """ <div class="alert alert-danger"> Please Enter valid information </div></div>""",
            )

    return dajax.json()
Exemplo n.º 5
0
def remove_phone(request, customer_id=None, phone_id=None):
    dajax = Dajax()
    dajax.assign("#message1", "innerHTML", "")
    if request.user.is_authenticated:
        if customer_id:
            customer = Customer.objects.get(id=customer_id)
            if customer:
                phone = PhoneNumber.objects.get(id=phone_id)
                phone.delete()
                dajax.assign(
                    "#message1",
                    "innerHTML",
                    """ <div class="alert alert-success"> Successfully Removed customer {0} PhoneNumber<div>""".format(
                        customer.name
                    ),
                )
                dajax.script("LocationReload();")
            else:
                dajax.assign(
                    "#message1", "innerHTML", """<div class="alert alert-danger"> No permission </div></div>"""
                )
        else:
            dajax.assign("#message1", "innerHTML", """ <div class="alert alert-danger"> No permission </div></div>""")

    return dajax.json()
Exemplo n.º 6
0
def edit_sales_tax(request,tid,state,tax):
	dajax = Dajax()

	print "Edit Sale Taxes"

	if isinstance(request.user,Staff) and request.user.user_type == 'A':

		if tid and state and float(tax):

			sale_tax = SaleTax.objects.get(id=tid)

			print sale_tax,tid,state,float(tax)

			sale_tax.state = state
			sale_tax.tax_amount = float(tax)
			sale_tax.save()

			dajax.assign('#success-head', 'innerHTML', '<strong>Success!</strong>')
			dajax.assign('#success-body', 'innerHTML', 'The state <b> {0} </b> has been updated successfully .'.format(sale_tax.state))
			dajax.script("Success();")
		
		else:
			dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
			dajax.assign('#warning-body', 'innerHTML', "We're sorry, but something went wrong. Please be sure that you entered a valid form.")
			dajax.script("Warning();")

			
	return dajax.json()
Exemplo n.º 7
0
def edit_slider_content(request,lang,sid=None,title=None,caption=None,url=None,priority=None):
    dajax = Dajax()
    if isinstance(request.user,Staff) and request.user.user_type == 'A':
        try:
            slider = Slider.objects.get(id=sid)
            if title and caption and priority:

                if lang == 'zh':
                    slider.title_zh  = title
                    slider.captions_zh  = caption
                else:
                    slider.title  = title
                    slider.captions  = caption

                slider.url  = url
                slider.priority  = priority

                slider.save()

                dajax.assign('#success-head', 'innerHTML', '<strong>Success!</strong>')
                dajax.assign('#success-body', 'innerHTML', 'The <b> {0} </b> has been edited successfully .'.format(slider.title))

                dajax.script("HIDEmodal();")
                # dajax.script("Success();")
            else:
                dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
                dajax.assign('#warning-body', 'innerHTML', 'Something went wrong')
                # dajax.script("Warning();")
                dajax.script("HIDEWmodal();")
        except Slider.DoesNotExist:
            pass
    else:
        return HttpResponseRedirect(reverse('login'))
    return dajax.json()
Exemplo n.º 8
0
def delete_repo(request,rid):
	dajax = Dajax()

	if isinstance(request.user,Staff) and request.user.user_type == 'P':
		if rid:
			Product.objects.get(id=int(rid)).delete()

			dajax.script('LocationReload();')

	elif isinstance(request.user,Staff) and request.user.user_type == 'E':
		if rid:
			product = Product.objects.get(id=int(rid))
			product.is_delete = True
			product.save()

			dajax.script('SuccessReturn();')

	elif isinstance(request.user,Staff) and request.user.user_type == 'A':
		if rid:
			product = Product.objects.get(id=int(rid))
			product.delete()

			dajax.script('SuccessReturn();')


	return dajax.json()
Exemplo n.º 9
0
def get_shipping_rate(request,weight,unit):
	dajax = Dajax()
	print "inside the Sales tax"

	dajax.assign('#shipping_rate', 'value', '')

	if weight and unit:
		if unit == 'GM':
			weight = float(weight)/1000

		price = 0.0
		try:
			sr = ShippingCharges.objects.filter(min_weight__lte=float(weight),max_weight__gte=float(weight)).order_by('-id')[0]
			price = sr.amount
		except:
			sr = ShippingCharges.objects.filter(min_weight__lte=float(weight),is_infinite=True).order_by('-id')[0]
			price = sr.amount

		shipping_rate = float(weight)*float(price)

		default_rate = float(SiteConfigurations.objects.get().shipping_charge_default)

		print "Default####",default_rate

		if shipping_rate < default_rate:
			shipping_rate = default_rate

		print "Shipping ######",shipping_rate

		dajax.assign('#shipping_rate', 'value','{0}'.format(format(shipping_rate,'.2f')))
		dajax.script('Calculation();')
	return dajax.json()
Exemplo n.º 10
0
def delete_product(request,pid):
	dajax = Dajax()

	if pid:
		product = Product.objects.get(id=int(pid))
		name = product.name

		if request.user.user_type == 'A':
			product.delete()
		else:
			product.is_delete = True
			product.save()

			history = ProductHistory()
			history.product = product
			history.person = request.user
			history.act_type = 'DL'
			history.description = "Delete product"
			history.save()


		dajax.assign('#success-head', 'innerHTML', '<strong>Success!</strong>')
		dajax.assign('#success-body', 'innerHTML', 'The <b> {0} </b> has been deleted successfully .'.format(name))
		dajax.script("Success();")

	return dajax.json()
Exemplo n.º 11
0
def add_sales_tax(request,states,rates):
	dajax = Dajax()

	print "Add Sale Taxes"

	if isinstance(request.user,Staff) and request.user.user_type == 'A':

		if states and rates:

			print "List",states,rates

			if len(states) == len(rates):
				for x in range(0, len(states)):
					print x,states[x],rates[x]
					sale_tax =  SaleTax()
					sale_tax.state = states[x]
					sale_tax.tax_amount = float(rates[x])
					sale_tax.save()

				dajax.assign('#success-head', 'innerHTML', '<strong>Success!</strong>')
				dajax.assign('#success-body', 'innerHTML', 'The sale tax has been added successfully .')
				dajax.script("Success();")
			else:
				dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
				dajax.assign('#warning-body', 'innerHTML', "We're sorry, but something went wrong. Please be sure that you entered a valid form.")
				dajax.script("Warning();")

			
		else:
			dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
			dajax.assign('#warning-body', 'innerHTML', "We're sorry, but something went wrong. Please be sure that you entered a valid form.")
			dajax.script("Warning();")

			
	return dajax.json()
Exemplo n.º 12
0
def general_settings(request,short_limit,site_name,image_count,exchange_rate,duty_rate_factor,shipping_charge_default,margin_charge_default):
	dajax = Dajax()

	print "General settings Save - Solo Models"

	if isinstance(request.user,Staff) and request.user.user_type == 'A':

		print "hai"

		if site_name and int(image_count) and int(short_limit) and float(exchange_rate) and float(duty_rate_factor) and float(shipping_charge_default) and float(margin_charge_default):

			site_settings = SiteConfigurations.objects.get()

			site_settings.site_name = site_name
			site_settings.image_count = int(image_count)
			site_settings.duty_rate_factor = duty_rate_factor
			site_settings.exchange_rate = exchange_rate
			site_settings.shipping_charge_default = shipping_charge_default
			site_settings.margin_charge_default = margin_charge_default
			site_settings.short_limit = short_limit

			site_settings.save()

			dajax.assign('#success-head', 'innerHTML', '<strong>Success!</strong>')
			dajax.assign('#success-body', 'innerHTML', 'The site global settings has been updated successfully .')
			dajax.script("Success();")
		
		else:
			dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
			dajax.assign('#warning-body', 'innerHTML', "We're sorry, but something went wrong. Please be sure that you entered a valid form.")
			dajax.script("Warning();")

			
	return dajax.json()
Exemplo n.º 13
0
def delete_tax(request,tid):
	dajax = Dajax()

	print "Delete Sale Taxes"

	if isinstance(request.user,Staff) and request.user.user_type == 'A':

		if tid:

			sale_tax = SaleTax.objects.get(id=tid)

			state = sale_tax.state

			sale_tax.delete()

			dajax.assign('#success-head', 'innerHTML', '<strong>Success!</strong>')
			dajax.assign('#success-body', 'innerHTML', 'The state <b> {0} </b> has been deleted successfully .'.format(state))
			dajax.script("Success();")
		
		else:
			dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
			dajax.assign('#warning-body', 'innerHTML', "We're sorry, but something went wrong. Please be sure that you entered a valid form.")
			dajax.script("Warning();")

			
	return dajax.json()
Exemplo n.º 14
0
def quick_view_photographer(request,value=None):

	print "hello inside the ajax"
	dajax = Dajax()

	if value:

		try:
			staff = Staff.objects.get(id=value)
			dajax.assign('#ph_head', 'innerHTML', '')
			dajax.assign('#ph_image', 'innerHTML', '')
			dajax.assign('#ph_name', 'innerHTML', '')
			dajax.assign('#ph_email', 'innerHTML', '')
			dajax.assign('#ph_mobile', 'innerHTML', '')
			dajax.assign('#ph_wechat', 'innerHTML', '')

			dajax.assign('#ph_head', 'innerHTML', ''' <i class='fa fa-user'></i> {0} Profile'''.format(staff.get_full_name()))
			dajax.assign('#ph_image', 'src', '{0}'.format(staff.image_display()))
			dajax.assign('#ph_name', 'innerHTML','{0}'.format(staff.get_full_name()))
			dajax.assign('#ph_email', 'innerHTML','{0}'.format(staff.email))
			dajax.assign('#ph_mobile', 'innerHTML','{0}'.format(staff.mobile))
			dajax.assign('#ph_wechat', 'innerHTML','{0}'.format(staff.we_chat))


			dajax.script('QuickView();')

		except Staff.DoesNotExist:
			pass

	return dajax.json()
Exemplo n.º 15
0
def get_compititor_avg(request,pid):
	dajax = Dajax()

	print "Inside Compititor Average PriceAvg  "

	if pid:

		product = Product.objects.get(id=int(pid))

		competitor_aveg = 0
		avg = 0
		com_sum = 0
		if product.competitor.all():
			for competitor in product.competitor.all():
				com_sum = com_sum+competitor.price

			avg = com_sum/product.competitor.all().count()
			competitor_aveg=[product.competitor.all().count(),float(com_sum),avg]

		print "competatior_avg",avg,competitor_aveg
		dajax.assign('#compi_avg', 'value','{0}'.format(format(avg,'.2f')))
		dajax.assign('#compi_count', 'value','{0}'.format(format(product.competitor.all().count(),'.2f')))
		dajax.assign('#compi_sum', 'value','{0}'.format(format(com_sum,'.2f')))


		dajax.script("updateCompetitorPrice();")

	return dajax.json()
Exemplo n.º 16
0
def add_category(request,name,lang):
	dajax = Dajax()

	print "Inside Add Category",lang,name
	if name:
		node = Category()

		try:
			if lang == 'zh':
				print "Chinese"
				node.name = name
				node.name_zh = name
			else:
				print "English"
				node.name = name

			node.save()
			print "Save"

			dajax.assign('#success-head', 'innerHTML', '<strong>Success!</strong>')
			dajax.assign('#success-body', 'innerHTML', 'The <b> {0} </b> has been added successfully .'.format(name))
			dajax.script("Success();")
		except:
			dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
			dajax.assign('#warning-body', 'innerHTML', "The Category <b> {0} </b> already exist".format(name))
			dajax.script("Warning();")

	return dajax.json()
Exemplo n.º 17
0
def add_masterstores(request,name,lang,mid=None):
	dajax = Dajax()

	print "Add MasterStore",name,mid

	if lang == 'zh':
		if name and mid:
			if not MasterStore.objects.filter(name=name).exclude(id=int(mid)):
				masterstore = MasterStore.objects.get(id=int(mid))
				masterstore.name_zh = name
				masterstore.save()

				dajax.script('LocationReload();')
			else:
				dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
				dajax.assign('#warning-body', 'innerHTML', 'The <b> {0} </b> has been already exist in Manufacturers .'.format(name))
				dajax.script("Warning();")

		elif name:
			if not MasterStore.objects.filter(name=name):
				print "Master Store"
				masterstore = MasterStore()
				masterstore.name_zh = name
				masterstore.save()

				dajax.script('LocationReload();')
			else:
				dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
				dajax.assign('#warning-body', 'innerHTML', 'The <b> {0} </b> has been already exist in Manufacturers .'.format(name))
				dajax.script("Warning();")
	else:
		if name and mid:
			if not MasterStore.objects.filter(name=name).exclude(id=int(mid)):
				masterstore = MasterStore.objects.get(id=int(mid))
				masterstore.name = name
				masterstore.save()

				dajax.script('LocationReload();')
			else:
				dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
				dajax.assign('#warning-body', 'innerHTML', 'The <b> {0} </b> has been already exist in Manufacturers .'.format(name))
				dajax.script("Warning();")

		elif name:
			if not MasterStore.objects.filter(name=name):
				print "Master Store"
				masterstore = MasterStore()
				masterstore.name = name
				masterstore.save()

				dajax.script('LocationReload();')
			else:
				dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
				dajax.assign('#warning-body', 'innerHTML', 'The <b> {0} </b> has been already exist in Manufacturers .'.format(name))
				dajax.script("Warning();")

	return dajax.json()
Exemplo n.º 18
0
def delete_image(request,iid):
	dajax = Dajax()

	if iid:
		ProductGallery.objects.get(id=int(iid)).delete()

		dajax.script('CheckRemainingCount();')

	return dajax.json()
Exemplo n.º 19
0
def delete_discount(request,did):
	dajax = Dajax()

	if did:
		discount = Discount.objects.get(id=did)
		discount.delete()

		dajax.script('Calculation();')

	return dajax.json()
Exemplo n.º 20
0
def check_mail(request,check_email=None):
	dajax = Dajax()
	if User.objects.filter(email=check_email) or  User.objects.filter(username=check_email):

		print "already exist^^^^^^"
		dajax.assign('#username-status', 'innerHTML', '''<p  style=" margin-top: -8px; color: red;  ">*E-Mail Already Exist, Choose another one !</p>''')
	else:
		dajax.assign('#username-status', 'innerHTML', '''<p  style=" margin-top: -8px; color: green; ">*E-Mail Id Does not Exist</p>''')

	return dajax.json()
Exemplo n.º 21
0
def activate(request,sid):
	dajax = Dajax()


	staff = Staff.objects.get(id=int(sid))
	staff.is_active = True
	staff.save()

	dajax.script("LocationReload();")

	return dajax.json()
Exemplo n.º 22
0
def activate_reseller(request,rid):
	dajax = Dajax()


	reseller = Reseller.objects.get(id=int(rid))
	reseller.is_active = True
	reseller.save()

	dajax.script("LocationReload();")

	return dajax.json()
Exemplo n.º 23
0
def add_to_downloadpopup(request):
	print "inside add_to_downloadpopup ^^^^^^^^^^^^^^^^^"

	dajax = Dajax()

	if isinstance(request.user,Reseller) and request.user.user_type == 'R':

		dajax.assign('#download-items', 'innerHTML', '')

		if 'download' in request.session:

			print "inside the Add to Popup"

			download_list = request.session['download']

			print "Download List###########",download_list

			if download_list:
				dajax.assign('#download-count', 'innerHTML',
						 '''<span class="download_count download_delay_hover circle">{0}</span>'''.format(len(download_list)))
				
				for download_item in download_list:

					product = Product.objects.get(id=int(download_item['id']))

					dajax.append('#download-items','innerHTML', '''
						<tr id="downid_{5}" class="downloadItemsRow" >
							<td class="downloaded_pro_name">
								<div class="downloaded_thumb"><a href="/product-detail/{2}"><img src="{0}"
								alt="{1}" class=""></a></div>
							</td>

							<td class="downloaded_pro_name">
								<a href="javascript:;" alt="download"><span>{1}</span></a>
								<label class="item_upc_code"><a href="/product-detail/{2}" alt="item_upc_code"><span>{3}</span></a><label>
							</td>

							<td class="downloaded_pro_name">
								<a href="javascript:;" alt="download"><span>{4}</span></a>
							</td>
							<td class="downloaded_pro_name">
								<span style="cursor:pointer" onclick="RemoveDownload_Item({5})" title="Remove"><i class="fa fa-remove"> Remove</i></span>
							</td>
						</tr>'''.format(product.prod_f_photo()[0], product.name, product.slug, product.upc, format(product.network_price,'.2f'),product.id))
			else:
				dajax.assign('#download-count', 'innerHTML',
						 '''<span class="download_count download_delay_hover circle">{0}</span>'''.format(len(download_list)))
				dajax.assign(
					'#download-items', 'innerHTML', '''<tr class="" >
							<td class="downloaded_pro_name">
								<a href="" alt="download"><span>Currently no items for downloading..!</span></a>
							</td> </tr>''')

		return dajax.json()
Exemplo n.º 24
0
def delete_slider(request,value=None):

    dajax = Dajax()
    if isinstance(request.user,Staff) and request.user.user_type == 'A':
        try:
            slider = Slider.objects.get(id=value)
            slider.delete()
            dajax.script("LocationReload();")
        except Slider.DoesNotExist:
            pass
    return dajax.json()
Exemplo n.º 25
0
def image_processing(request,iid,im_type):
	dajax = Dajax()
	print "Inside Add Image to Categories"
	if im_type and iid:

		image = ProductGallery.objects.get(id=iid)
		image.image_type = im_type
		image.save()

		print "Saved"

	return dajax.json()
Exemplo n.º 26
0
def edit_margin_charge(request,mid,min_bp,max_bp,amount,is_infinite=None):
	dajax = Dajax()

	print "Edit Margin Charge ",mid,min_bp,max_bp,amount,is_infinite

	if isinstance(request.user,Staff) and request.user.user_type == 'A':

		if mid and min_bp :

			margin_charge = MarginChargesTable.objects.get(id=mid)

			if is_infinite and MarginChargesTable.objects.filter(is_infinite=True).exclude(id=margin_charge.id):
				print "More than Is infinite"
				dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
				dajax.assign('#warning-body', 'innerHTML', "We're sorry, you can't put infinite to more than one field")
				dajax.script("Warning();")
			else:
				print "Not More than Is infinite"
				margin_charge.min_bp = float(min_bp)
				
				if max_bp:
					margin_charge.max_bp = float(max_bp)
				else:
					margin_charge.max_bp = None

				if amount:
					margin_charge.amount = float(amount)
				else:
					margin_charge.amount = 0.0

				if is_infinite:
					margin_charge.is_infinite = True
				else:
					margin_charge.is_infinite = False

				print "before save"

				margin_charge.save()

				print "Save"

				dajax.assign('#success-head', 'innerHTML', '<strong>Success!</strong>')
				dajax.assign('#success-body', 'innerHTML', 'The margin charge has been updated successfully .')
				dajax.script("Success();")
		
		else:
			dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
			dajax.assign('#warning-body', 'innerHTML', "We're sorry, but something went wrong. Please be sure that you entered a valid form.")
			dajax.script("Warning();")

			
	return dajax.json()
Exemplo n.º 27
0
def get_discount(request,product):
	dajax = Dajax()

	product = get_object_or_404(Product, id=int(product))

	dajax.assign('#discount_rows', 'innerHTML', '')

	discounts = product.discount.all().order_by('-id')

	if discounts:
		for counter,discount in enumerate(discounts):

			if discount.is_active():
				dajax.append('#discount_rows', 'innerHTML','''
					<tr id="dis{5}">
						<td>{0}</td>
						<td>{1}</td>
						<td>{2}%</td>
						<td>{3}</td>

						<td>{4}</td>

						<td><a class="btn btn-success btn-icon btn-circle"><i class="fa fa-check"></i></a></td>

						<td>
							<button type="button" onclick="DeleteDiscount({5});" class="btn btn-sm btn-warning"><i class="fa fa-trash"></i> Delete</button>
						</td>
					</tr>

					'''.format(counter+1,discount.name,discount.discount,discount.effe_date.strftime("%d %b %Y"),discount.expi_date.strftime("%d %b %Y"),discount.id))
			else:
				dajax.append('#discount_rows', 'innerHTML','''
					<tr id="dis{5}">
						<td>{0}</td>
						<td>{1}</td>
						<td>{2}%</td>
						<td>{3}</td>

						<td>{4}</td>

						<td><a class="btn btn-danger btn-icon btn-circle"><i class="fa fa-times"></i></a></td>

						<td>
							<button type="button" onclick="DeleteDiscount({5});" class="btn btn-sm btn-warning"><i class="fa fa-trash"></i> Delete</button>
						</td>
					</tr>

					'''.format(counter+1,discount.name,discount.discount,discount.effe_date.strftime("%d %b %Y"),discount.expi_date.strftime("%d %b %Y"),discount.id))

		dajax.script('ShowDiscountTable();')

	return dajax.json()
Exemplo n.º 28
0
def check_upc(request,pid,upc):
	dajax = Dajax()

	print "Check UPC"

	if pid:

		if Product.objects.filter(upc=upc).exclude(id=pid):
			dajax.assign('#upc_alert', 'innerHTML',''' <span class="label label-warning">Warning</span> Product UPC Already Exist, Choose another one !''')
		else:
			dajax.assign('#upc_alert', 'innerHTML',''' <span class="label label-success">Success</span> Product UPC Does not Exist.''')

	return dajax.json()
Exemplo n.º 29
0
def contact_admin(request,name=None,email=None,msg=None):
    dajax = Dajax()
    dajax.assign('#message', 'innerHTML', '')
    if name and email and msg:
        contact = Contact()
        contact.name = name
        contact.email = email
        contact.message = msg
        contact.save()
        dajax.assign('#message', 'innerHTML', ''' <div class="alert alert-success"> Thank you "" {0} "" ! Successfully send message with us Our admin teamm will contact you soon </div>'''.format(contact.name))
    else:
        dajax.assign('#message','innerHTML', ''' <div class="alert alert-danger"> Please Enter valid information </div></div>''')

    return dajax.json()
Exemplo n.º 30
0
def deactivate_faq(request,value=None):
    dajax = Dajax()

    if isinstance(request.user,Staff) and request.user.user_type == 'A' :

        try:
            faq = Faq.objects.get(id=value)
            faq.is_active = False
            faq.save()
            dajax.script("LocationReload();")
        except Faq.DoesNotExist:
            pass

    return dajax.json()